On 12/12/06, Jan Ciger <[EMAIL PROTECTED]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

bertrand greslier wrote:
> Hi Jan,
>
> Add automaticaly a try catch or automaticly recode a similar multiple
> inheritance seems not be difficult.
> Example class A { int x; }; class B{ int y; }; class C : public A, B {
int
> z; public:  void test(){z = x + y:} ; };
> =>(java translation) => public class C : extends A {  int z; B b; public
> void test(){ z = x + b.y; } };

This is completely wrong - you have replaced inheritance with aggregation
which
is a completely different beast.

What if I want to derive a class D from your
class C? In C++ it will inherit properties of A and B. In your case it
will not.
The proper way would be to convert one of these to an interface, but this
is
probably not doable automatically. Such class hierarchies are common in
OSG (or
any C++ program using multiple inheritance).


"completely" is wrong, my example is not a rule and not for all case
but you can't say it is completly wrong, it is an example nothingelse.
And replace inheritance with aggregation is a part of the solution,
add an interface to represent B methods is also another part but in my
example class A & B have just one attribut and zero methods.
This example write in 5second in not here to prove my level of C++ and I
have nothing to prove.
And for this example, if your class D inherit from the C, it must access to
the y attribut of B class with the b instance of C.
If you change my example, it is not my example it is your example, be aware
of this.

(What is that IMHO please?? I am not very fluent in english)

IMHO = In My Humble Opinion

> C code is not object oriented code. I think you don't compare apples
with
> apples.

Well, in fact porting C to Java is simpler than porting C++ (much smaller
feature set) and this was done manually, without trying to write an
automated
translator first. This was a much smaller task than what you propose, in
my
opinion, and it went horribly wrong.


I have try to say that porting C to java is more difficult to maintain after
the parsing
for a java devloppoer because you can't generate an orientied object code.

And I am a java expert (I believe it ;-)).

However you are for sure no C++ expert as you can clearly see from your
botched
example of multiple inheritance.


Please say give me a better exemple with... instead of this.  Because it is
difficult very to remain zen for me.

Regards,

--
Bertrand Greslier
http://www.cooki3d.org
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to