[Gambas-user] Object Inheritance

Adi Ron ronsholi at ...406...
Tue Apr 6 22:42:35 CEST 2004


On Tuesday 06 April 2004 22:07, Benoit Minisini wrote:
> On Wednesday 07 April 2004 21:50, Fabien Bodard wrote:
> > Le mardi 6 Avril 2004 00:15, Benoit Minisini a écrit :
> > > On Monday 05 April 2004 20:35, Ronan Chilvers wrote:
> > > > Hi folks
> > > >
> > > > Quick question on inheritance.  How does it work in gambas?  For
> > > > example:-
> > > >
> > > > 2 classes
> > > > 	MyParentClass
> > > > 	MyChildClass
> > > >
> > > > and I want MyChildClass to inherit the properties and methods of
> > > > myParentClass.  How do I do this ?
> > > >
> > > > Cheers
> > > >
> > > > Ronan
> > >
> > > Adds "INHERITS MyParentClass" to the beginning of MyChildClass.
> > >
> > > Regards,
> >
> > It seem to be not documented ... isn't it ?
> >
> > When have you had this feature benoit, i don't find it in the change
> > log....
> >
> > Fabien
> >
> > Mabe when i was sleeping
>
> Hum... Yes, it was not documented. And the feature is there since... gambas
> 0.20 :-)
>
> It is mainly used to make forms. Every form class defined in a project
> inherits the Form class.
>
> Note that an interpreted class can inherits a native class. It works well
> for Form. But I didn't really tested what happened if you inherits
> something like Collection. It should work. But this is why I didn't claim
> it.
>
> Well, now, everybody knows :-)

It isn't really a useful function. OK, no maybe two here will say "No! But I 
use it all the time!", that's OK, but I inheriting classes is rarely useful, 
and is what I count as bad coding behaviour when coding with more people that 
need to read the code afterwards.

Admit it that the line "I am FooBar the second, son of FooBar" gives less 
information than "I am Foobar the second, son of a great musician FooBar" to 
human viewers.

If you wanna piss off your other colleges and friend-coders -- never comment 
your code, use annoying IF .. ELSE IF .. ELSE IF .. ELSE IF instead of 
SELECT, inherit classes and do the same thing all over instead of looping it.
But only if you really hate them!
-- 
"Why don't kernels have emotions yet?"
	--Adi Ron when asked about the future of Linux
__    _  _   _____  _   _ ( )  _ _  _
\  \ [ || ] / , __/| | / /| | |   \| |
|()| | || | \ \    | |/ / | | | |\ \ |
/_ /_\____/__\ /   |_|\ \_|_|_|_| \__/__
______________/        \________________\
http://strange-man.blogspot.com





More information about the User mailing list