Syntax

Y

yma

Hi,

In a subclass, is

sub new()
end sub

the same as

sub new()
mybase.new()
end sub


Thanks

Chris Ma
 
D

Daniel Bass

No,

the first instantiates <subclass>::new(), and if it exists in the base
class, overrides it so that the <baseclass>::new() is not called.
the seconds does the first, but then calls any instantiation of the
baseclass as well...

the second is used if you have something that's initialised in the base
class, which you want initialised, but then wish to further initialise in
some way...

for example...

base class is called Animal
the sub class is called Dog

you may say that an animal as the class action, which then calls initialises
breathe...
but then the Dog calls this base initialisation and calls Bark... you want
both Bark and Breathe to be initialised or the dog won't be barking for
long!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top