[chuck-users] multiple inheritance

Julien Saint-Martin julien.saintmartin at googlemail.com
Fri Oct 5 10:54:28 EDT 2012


That the approach I m thinking about now.

But this way (including one object into one other) constraints you to have
additional interface functions?
Ok I know my question is not clear ;-) let's illustrate it with an example:

class A{ void fun do_stuff() { /* do stuff ....*/  } }

If I want to have the same do_stuff functionality in another class, if I
extend it, I have nothing to do.
class B extends A {}  // B Will automatically have the do_stuff
functionality

But if I include it, I have to do:
class B { A a; // sort of include
              fun void do_stuff() {a.do_stuff();} /// This is the
additional interface I told about in my question
}

Then I will be able to do:
B b;
b.do_stuff();

Ok it s just one line of code in this example but it can be much more if
you have several functions and several class extensions.

If you feel I am lazy its true ;-) That's why I like to program, I make the
machines work for me!

Ju




2012/10/5 Kassen <signal.automatique at gmail.com>

> On Fri, Oct 05, 2012 at 02:59:16PM +0200, Julien Saint-Martin wrote:
> > Hi Kassen,
> >
> > Ok, thank you for your response.
> > No problem, you don't have to be sorry. I survived ten years programming
> > without objects so I will find an other solution ;-)
>
> Personally I never felt the need to extend multiple things at once, to
> be honest, I tend more towards having one big object include several
> smaller ones. I could see how it could save on the copy-pasting and
> keeping track of where you copy-pasted when you edit one case.
>
> Oh, well...
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20121005/81431bd2/attachment.html>


More information about the chuck-users mailing list