First page Back Continue Last page Overview Graphics
Constructor Basic Differences
C++
- Constructors have specific name
- Child and Parents both have constructors
- Instantiating child calls both constructors
- example1.cpp
Perl
- Constructors can be called anything
- convention is to call them “new”
- Only Parent has constructor
- Typically _init method called from constructor
- Allows child class to do its initialization
- example1.pl