Topic 11: Object-oriented Perl CSE3395 Perl Programming Camel3 chapter 12, pages 308-346 perlobj, perltoot, perlbot, perlmod manpages.

Slides:



Advertisements
Similar presentations
Object-Oriented programming in C++ Classes as units of encapsulation Information Hiding Inheritance polymorphism and dynamic dispatching Storage management.
Advertisements

Objected Oriented Perl An introduction – because I don’t have the time or patience for an in- depth OOP lecture series…
Chapter 7: User-Defined Functions II
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Evan Korth New York University Inheritance and Polymorphism Professor Evan Korth New York University.
Classes and Objects  A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
1 Evan Korth New York University Inheritance and Polymorphism Professor Evan Korth New York University.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
ISE 582: Web Technology for Industrial Engineers University of Southern California Department of Industrial and Systems Engineering Lecture 4 JAVA Cup.
Abstract Data Types and Encapsulation Concepts
Programming Languages and Paradigms Object-Oriented Programming.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Chapter 12: Adding Functionality to Your Classes.
CSE 425: Object-Oriented Programming II Implementation of OO Languages Efficient use of instructions and program storage –E.g., a C++ object is stored.
Chapter 8 More Object Concepts
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
1 Chapter 10: Data Abstraction and Object Orientation Aaron Bloomfield CS 415 Fall 2005.
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
Polymorphism, Inheritance Pt. 1 COMP 401, Fall 2014 Lecture 7 9/9/2014.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Programming Languages and Paradigms Object-Oriented Programming.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Week 14 - Monday.  What did we talk about last time?  Introduction to C++  Input and output  Functions  Overloadable  Default parameters  Pass.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Object-Based Programming Mostly Review. Objects Review what is object? class? member variables? member functions? public members? private members? friend.
1 Chapter Four Creating and Using Classes. 2 Objectives Learn about class concepts How to create a class from which objects can be instantiated Learn.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
Classes. Constructor A constructor is a special method whose purpose is to construct and initialize objects. Constructor name must be the same as the.
Chapter 5 Objects and Classes Inheritance. Solution Assignments 3 & 4 Review in class…..
Topic 4:Subroutines CSE2395/CSE3395 Perl Programming Learning Perl 3rd edition chapter 4, pages 56-72, Programming Perl 3rd edition pages 80-83,
Object-Oriented Programming Chapter Chapter
OOP in C++ CS 124. Program Structure C++ Program: collection of files Source (.cpp) files be compiled separately to be linked into an executable Files.
Classes Modeling the Object. Objects model the world Classes are programmer defined types that model the parts of a system Class serve as blueprints for.
Object Oriented Programming
Topic 2: Working with scalars CSE2395/CSE3395 Perl Programming Learning Perl 3rd edition chapter 2, pages 19-38, Programming Perl 3rd edition chapter.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
ISBN Object-Oriented Programming Chapter Chapter
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
CPRG 215 Introduction to Object-Oriented Programming with Java Module 3- Introduction to Object Oriented Programming concepts Topic 3.4 Constructors, Overloading,
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Classes, Interfaces and Packages
Chapter 11: Inheritance and Composition. Introduction Two common ways to relate two classes in a meaningful way are: – Inheritance (“is-a” relationship)
Subclassing, pt. 2 Method overriding, virtual methods, abstract classes/methods COMP 401, Fall 2014 Lecture 9 9/16/2014.
Chapter 1 C++ Basics Review (Section 1.4). Classes Defines the organization of a data user-defined type. Members can be  Data  Functions/Methods Information.
Intro to Object Oriented Perl Packages, Modules, Classes.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
POLYMORPHISM Chapter 6. Chapter Polymorphism  Polymorphism concept  Abstract classes and methods  Method overriding  Concrete sub classes and.
OOP Basics Classes & Methods (c) IDMS/SQL News
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
COP INTERMEDIATE JAVA Inheritance, Polymorphism, Interfaces.
ISBN Chapter 12 Support for Object-Oriented Programming.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
Object Lifetimes and Dynamic Objects Lecture-7. Object Lifetimes and Dynamic Objects External (Global) Objects Persistent (in existence) throughout the.
These materials where developed by Martin Schray
Java Primer 1: Types, Classes and Operators
Class: Special Topics Copy Constructors Static members Friends this
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Topic 11: Object-oriented Perl CSE3395 Perl Programming Camel3 chapter 12, pages perlobj, perltoot, perlbot, perlmod manpages

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 2 In this topic  Classes as modules  Defining methods ► object methods ► class methods ► constructors ► destructors  Creating objects ► bless keyword  Inheritance array ► polymorphism  Comparison with other OO languages ► Java, C++  Classes as modules  Defining methods ► object methods ► class methods ► constructors ► destructors  Creating objects ► bless keyword  Inheritance array ► polymorphism  Comparison with other OO languages ► Java, C++

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 3 Additional information about OO  Advanced Perl Programming ► chapters 6-8  Object-oriented Perl ► by Damian Conway ► Manning Press, first edition 2000  manpages ► perlmod –about packages and modules ► perltoot –Tom’s object-oriented tutorial; simpler introduction to OO Perl ► perlobj –official reference, complete but terse ► perlbot –Bag of Object Tricks; some more complex OO stuff  Advanced Perl Programming ► chapters 6-8  Object-oriented Perl ► by Damian Conway ► Manning Press, first edition 2000  manpages ► perlmod –about packages and modules ► perltoot –Tom’s object-oriented tutorial; simpler introduction to OO Perl ► perlobj –official reference, complete but terse ► perlbot –Bag of Object Tricks; some more complex OO stuff

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 4 Object-orientation  A class is a description of a type of thing  An object is an instance of a class  A method is a function that operates on a class or object ► class methods (static methods) apply to the class as a whole ► object methods (instance methods) apply to one object  A constructor is a method called at object creation  A destructor is a method called at object destruction  Inheritance is the is-a relationship between two classes ► describes default behaviour of a class ► derived class inherits from base class  Polymorphism is the selection of the correct derived method based on the class of the object  A class is a description of a type of thing  An object is an instance of a class  A method is a function that operates on a class or object ► class methods (static methods) apply to the class as a whole ► object methods (instance methods) apply to one object  A constructor is a method called at object creation  A destructor is a method called at object destruction  Inheritance is the is-a relationship between two classes ► describes default behaviour of a class ► derived class inherits from base class  Polymorphism is the selection of the correct derived method based on the class of the object

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 5 Object-orientation in Perl  A class is a description of a type of thing ► in Perl, class is a module  An object is an instance of a class ► in Perl, object is a (usually anonymous) value ► object is identified by reference to value ► object looks like a scalar  A method is a function that operates on a class or object ► in Perl, method is a subroutine in the module  A constructor is a method called at object creation ► in Perl, constructor is a kind of object method which returns a (blessed) object  A class is a description of a type of thing ► in Perl, class is a module  An object is an instance of a class ► in Perl, object is a (usually anonymous) value ► object is identified by reference to value ► object looks like a scalar  A method is a function that operates on a class or object ► in Perl, method is a subroutine in the module  A constructor is a method called at object creation ► in Perl, constructor is a kind of object method which returns a (blessed) object Camel3 page 310; perlobj manpage

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 6 Using an OO module  use Class; ► use Car;  Everything else depends on class’ documentation  To call a class method: Class->cmethod(args) ► $vehicle = Car->new("ABC123"); ► new() is class method, doesn’t apply to any specific Car (yet) ► new() returns an object (i.e., constructor) –$vehicle is (a reference to) a Car object ► nothing special about name “new”, unlike Java/C++  To call an object method: $object->omethod(args) ► $odometer = $vehicle->odometer(); ► odometer() is object method, applies to a specific Car  use Class; ► use Car;  Everything else depends on class’ documentation  To call a class method: Class->cmethod(args) ► $vehicle = Car->new("ABC123"); ► new() is class method, doesn’t apply to any specific Car (yet) ► new() returns an object (i.e., constructor) –$vehicle is (a reference to) a Car object ► nothing special about name “new”, unlike Java/C++  To call an object method: $object->omethod(args) ► $odometer = $vehicle->odometer(); ► odometer() is object method, applies to a specific Car Camel3 pages ; perlobj, perltoot manpages

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 7 Writing an OO module  Create a package named for the class ► package Car;  For every method, create a subroutine ► sub new {... } ► sub odometer {... } ► class and object methods declared the same way  End the method with true value ► 1;  Save in module called Class.pm  Create a package named for the class ► package Car;  For every method, create a subroutine ► sub new {... } ► sub odometer {... } ► class and object methods declared the same way  End the method with true value ► 1;  Save in module called Class.pm

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 8 Writing a class method  To write a class method, declare subroutine ► sub new {  First parameter ( $_[0] ) is class name (string) ► usually same as current class, but could be derived class if it inherited method from current class ► my $classname = shift;  Remaining parameters are arguments from caller ► my ($plate)  To write a class method, declare subroutine ► sub new {  First parameter ( $_[0] ) is class name (string) ► usually same as current class, but could be derived class if it inherited method from current class ► my $classname = shift;  Remaining parameters are arguments from caller ► my ($plate)

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 9 Writing a constructor  Constructor usually a class method  To create an object: ► allocate the object’s storage, usually an anonymous hash –my $auto = { }; ► initialize the object with its default values –$auto->{"plate"} = $plate; –$auto->{"ident"} = create_identification(); –$auto->{"odo"} = 0; ► mark the object as belonging to a class using bless keyword –bless $auto, $classname; –bless allows Perl to know which module contains the right subroutine when invoking an object method ► return the reference to caller –return $auto;  Constructor usually a class method  To create an object: ► allocate the object’s storage, usually an anonymous hash –my $auto = { }; ► initialize the object with its default values –$auto->{"plate"} = $plate; –$auto->{"ident"} = create_identification(); –$auto->{"odo"} = 0; ► mark the object as belonging to a class using bless keyword –bless $auto, $classname; –bless allows Perl to know which module contains the right subroutine when invoking an object method ► return the reference to caller –return $auto; Camel3 pages

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 10 Timeout # Typical constructor (example of object method). package Car; # Constructor new(plate) # Create and return a new car with specified number plate. sub new { my $classname = shift; my ($plate) my $auto = { plate => $plate, ident => create_identification() odo => 0, # Lifetime odometer trip => 0 # Trip odometer }; bless $auto, $classname; return $auto; } # Typical constructor (example of object method). package Car; # Constructor new(plate) # Create and return a new car with specified number plate. sub new { my $classname = shift; my ($plate) my $auto = { plate => $plate, ident => create_identification() odo => 0, # Lifetime odometer trip => 0 # Trip odometer }; bless $auto, $classname; return $auto; }

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 11 Writing an object method  To write a object method, declare subroutine ► sub odometer {  First parameter ( $_[0] ) is object (reference to blessed value) ► my $self = shift; ► no special self or this pointer/reference  Remaining parameters are arguments from caller ► my ($trip, $reset)  To write a object method, declare subroutine ► sub odometer {  First parameter ( $_[0] ) is object (reference to blessed value) ► my $self = shift; ► no special self or this pointer/reference  Remaining parameters are arguments from caller ► my ($trip, $reset)

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 12 Timeout # Typical object method. package Car; use Carp; # For croak() function below. # Object method odometer(trip, reset) # Return either the lifetime (0) or trip (1) odometer, # and optionally reset it (trip odometer only). sub odometer { my $self = shift; my ($trip, $reset) # croak() is like built-in die() but reports error from # perspective of caller. croak("Tried to reset lifetime odometer") if $reset && !$trip; my $result = $self->{ $trip ? "trip" : "odo" }; $self->{"trip"} = 0 if $reset; return $result; } # Typical object method. package Car; use Carp; # For croak() function below. # Object method odometer(trip, reset) # Return either the lifetime (0) or trip (1) odometer, # and optionally reset it (trip odometer only). sub odometer { my $self = shift; my ($trip, $reset) # croak() is like built-in die() but reports error from # perspective of caller. croak("Tried to reset lifetime odometer") if $reset && !$trip; my $result = $self->{ $trip ? "trip" : "odo" }; $self->{"trip"} = 0 if $reset; return $result; }

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 13 Destructors  Destructor is called automatically when object falls out of scope ► i.e., its reference count falls to zero ► not called explicitly  In Perl, destructor is method called DESTROY (all capitals)  Seldom needed because Perl manages memory allocation  Some uses ► to keep track of class meta-data ► to dump persistent objects to disk ► to close a file or network connection  Destructor is called automatically when object falls out of scope ► i.e., its reference count falls to zero ► not called explicitly  In Perl, destructor is method called DESTROY (all capitals)  Seldom needed because Perl manages memory allocation  Some uses ► to keep track of class meta-data ► to dump persistent objects to disk ► to close a file or network connection Camel3 pages

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 14 Inheritance  A class can derive from one or more parent classes by setting array ► package = qw(Car StatusSymbol); ► Any method not found in class SportsCar will now fall back to the same-named methods in Car and StatusSymbol ► This is how Exporter.pm module works = qw(Exporter); # Inherit export() ► Can delegate to superclass (parent) with special SUPER:: class name –skips current class when dispatching method –$self->SUPER::method()  A class can derive from one or more parent classes by setting array ► package = qw(Car StatusSymbol); ► Any method not found in class SportsCar will now fall back to the same-named methods in Car and StatusSymbol ► This is how Exporter.pm module works = qw(Exporter); # Inherit export() ► Can delegate to superclass (parent) with special SUPER:: class name –skips current class when dispatching method –$self->SUPER::method() Camel3 pages ; perlobj manpage

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 15 Polymorphism  All method calls are dispatched at runtime in Perl  Method dispatch is based on ► class that object was blessed into ► name of method  All methods are by default polymorphic  All method calls are dispatched at runtime in Perl  Method dispatch is based on ► class that object was blessed into ► name of method  All methods are by default polymorphic

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 16 Timeout package Random; # new(n): create n-sided Random object. sub new { my $class = shift; my $self = { range => $_[0] }; return bless $self, $class; } # toss(): return result from 1 to object's range. sub toss { my $self = shift; $self->{"tosses"}++; # Count tosses. return int (rand $self->{"range"}) + 1; } sub DESTROY { my $self = shift; print "Did ", $self->{"tosses"}, " tosses on ", $self->{"range"}, "-sided\n" } 1; package Random; # new(n): create n-sided Random object. sub new { my $class = shift; my $self = { range => $_[0] }; return bless $self, $class; } # toss(): return result from 1 to object's range. sub toss { my $self = shift; $self->{"tosses"}++; # Count tosses. return int (rand $self->{"range"}) + 1; } sub DESTROY { my $self = shift; print "Did ", $self->{"tosses"}, " tosses on ", $self->{"range"}, "-sided\n" } 1;

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 17 Timeout package Die; use = qw(Random); # Inherit from Random. # Introduce roll() as synonym for toss() sub roll { my $self = shift; return } 1; package Die; use = qw(Random); # Inherit from Random. # Introduce roll() as synonym for toss() sub roll { my $self = shift; return } 1;

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 18 Timeout package Coin; use = qw(Random); # new(): make a coin object. Coins are 2-sided. sub new { my $class = shift; $class->SUPER::new(2); # Delegate to parent class, 2 sides. } # toss(): return "heads" or "tails" sub toss { my $self = shift; return == 1 ? "heads" : "tail"; } 1; package Coin; use = qw(Random); # new(): make a coin object. Coins are 2-sided. sub new { my $class = shift; $class->SUPER::new(2); # Delegate to parent class, 2 sides. } # toss(): return "heads" or "tails" sub toss { my $self = shift; return == 1 ? "heads" : "tail"; } 1;

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 19 Timeout #!/usr/bin/perl -w use Die; use Coin; $c = Coin->new(); $d6 = Die->new(6); $d10 = Die->new(10); # Do it 100 times. foreach ( ) { print $c->toss(), " ", $d6->roll() + $d10->roll(), "\n"; } #!/usr/bin/perl -w use Die; use Coin; $c = Coin->new(); $d6 = Die->new(6); $d10 = Die->new(10); # Do it 100 times. foreach ( ) { print $c->toss(), " ", $d6->roll() + $d10->roll(), "\n"; }

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 20 OO in Perl, Java and C++  Underlying representation ► Perl: anonymous hash/array/scalar, looked up by reference ► C++, Java: opaque structure similar to a C struct  Object methods and class methods ► Perl: equivalent syntax, distinguished by use ► C++, Java: class methods denoted by static keyword  Class data ► Perl: package-level global variables ► C++, Java: variables defined with static keyword  Underlying representation ► Perl: anonymous hash/array/scalar, looked up by reference ► C++, Java: opaque structure similar to a C struct  Object methods and class methods ► Perl: equivalent syntax, distinguished by use ► C++, Java: class methods denoted by static keyword  Class data ► Perl: package-level global variables ► C++, Java: variables defined with static keyword

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 21 OO in Perl, Java and C++  Instance data ► Perl: stored as key/value in object hash ► C++, Java: stored in opaque structure  Constructors ► Perl: a class method, called explicitly; must allocate object and initialize it; can have any name ► C++, Java: not strictly a method, called implicitly; need only initialize the object; new keyword has special meaning for object construction  Destructors ► Perl, C++, Java: an object method, invoked implicitly when object falls out of scope  Instance data ► Perl: stored as key/value in object hash ► C++, Java: stored in opaque structure  Constructors ► Perl: a class method, called explicitly; must allocate object and initialize it; can have any name ► C++, Java: not strictly a method, called implicitly; need only initialize the object; new keyword has special meaning for object construction  Destructors ► Perl, C++, Java: an object method, invoked implicitly when object falls out of scope

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 22 OO in Perl, Java and C++  Inheritance ► Perl, C++: multiple, (Perl) and :public Base (C++); no difference between inheritance and interfaces ► Java: single, using extends ; multiple inheritance approximated with interfaces  Polymorphism ► Perl, Java: applies to all method calls, runtime dispatch ► C++: disabled (compile-time dispatch) unless method declared with virtual keyword  Access control ► Perl: none, relies on programmer to honour documented interface ► C++, Java: enforced at compile time with public, private and protected keywords; C++ has friend keyword  Inheritance ► Perl, C++: multiple, (Perl) and :public Base (C++); no difference between inheritance and interfaces ► Java: single, using extends ; multiple inheritance approximated with interfaces  Polymorphism ► Perl, Java: applies to all method calls, runtime dispatch ► C++: disabled (compile-time dispatch) unless method declared with virtual keyword  Access control ► Perl: none, relies on programmer to honour documented interface ► C++, Java: enforced at compile time with public, private and protected keywords; C++ has friend keyword

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 23 OO in Perl, Java and C++  Method overloading ► Perl: none, only one method with each name ► C++/Java: all parameter types contribute to method signature  Operator overloading ► Perl, C++: yes, with use overload (Perl) and operator+ (etc.) methods (C++); infix/prefix notation converted to method calls ► Java: none  Method overloading ► Perl: none, only one method with each name ► C++/Java: all parameter types contribute to method signature  Operator overloading ► Perl, C++: yes, with use overload (Perl) and operator+ (etc.) methods (C++); infix/prefix notation converted to method calls ► Java: none

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 24 Covered in this topic  Classes as modules  Defining methods ► object methods ► class methods ► constructors ► destructors  Creating objects ► bless keyword  Inheritance array ► polymorphism  Comparison with other OO languages ► Java, C++  Classes as modules  Defining methods ► object methods ► class methods ► constructors ► destructors  Creating objects ► bless keyword  Inheritance array ► polymorphism  Comparison with other OO languages ► Java, C++

Original Slides by Debbie Pickett, Modified by David Abramson, 2006, Copyright Monash University 25 Going further  Operator overloading ► Camel3 chapter 13, pages  Autoloading ► generation of methods on the fly ► Camel3 pages  Closures ► another way of doing OO ► Camel3 pages ,  Operator overloading ► Camel3 chapter 13, pages  Autoloading ► generation of methods on the fly ► Camel3 pages  Closures ► another way of doing OO ► Camel3 pages ,