Hi Edward, Steve,

It's possible to use classes and objects only while using gtk3.

Have you a preference for using c++ in netman?

As Jude Nelson said: c++ is not a standardized language.

  Aitor.

Edward Bartolo <edb...@gmail.com> writes:
> >Is it possible to use classes and objects while using gtk2/3? I
> >noticed that only functions are used and that class use is ovoided
> >by prepending functions with a group string. As far as I know, C can
> >still use structs that are attached to a set of data and a set of
> >functions, but without inheritance and polymorphyism.
>
>C structs can be embedded into each other which means they can
>'inherit' other structs, eg, for a totally contrived example
>
>struct something {
>    int number0, number1;
>};
>
>struct another {
>    struct something parent;
>         int drei;
>};
That's composition, not inheritance. It's "has-a", not "is-a". You need
to name the whole chain when calling an element (someth->anoth->drei
rather than someth->drei).

If Edward's anything like me, we both learned OOP from that Philippe
Kahn video where Philippe plays a horn and speaks of these three
capabilities of objects:

* Encapsulation
* Inheritance
* Polymorphism

In my personal opinion, Encapsulation is by far the strongest benefit,
and in fact I seldom use inheritance and almost never use polymorphism.
So personally, I'm just fine with composing large objects with smaller
component objects, all the way down the tree. Especially since a lot of
that nesting can be hidden in methods (I'm pretty sure that function
pointers can be used as methods in C).

But technically, what you wrote above isn't inheritance.

SteveT

_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to