Re: [gob-list] Overriding constructors

From: Guillermo Ontañón <gontanon_at_dragon-lance.net>
Date: 01 Feb 2003 19:15:36 +0100

On Sat, 2003-02-01 at 18:18, George wrote:
>
> Do this the way most gtk+/gnome objects do add a construct method that does
> the construction. These are used purely for deriving. So this would work
> as:
>
> class foo from G:Object {
> private int a;
> public foo *new (int a) {
> foo *self = GET_NEW;
>
> construct (self, a);
>
> return self;
> }
> public void construct (self, int a) {
> foo *self = GET_NEW;
> self->_priv->a = a;
> return self;
> }
> }
>
> class fooChild from foo {
> private int b;
> public fooChild *new (int a, int b) {
> fooChild *self = GET_NEW;
> self->_priv->b = b;
>
> foo_construct (self, a);
> }
> }
>
> Though I suppose fooChild should also get a construct method to be nice and
> clean design.

Thanks a lot, that's what I was looking for. And thanks for writing GOB
too :-)

Regards,

-- 
Guillermo Ontañón
gontanon@dragon-lance.net || http://weezer.dragon-lance.net
GRupo de Usuarios de Linux de La Almunia - http://grulla.hispalinux.es
PGP key: 1024D/3AE9EA90 
Fingerprint: EF61 44E1 6725 A343 B165  2CEC 83C2 938B 3AE9 EA90

Received on Sat Feb 01 2003 - 13:15:16 CST

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:05:02 CDT