Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Recovering masked methods
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alessandro Baretta <alex@b...>
Subject: Re: [Caml-list] Recovering masked methods


Laurent Vibert wrote:
> On Tue, 16 Jul 2002, Alessandro Baretta wrote:
>>class c =
>>object
>>   inherit a as super_a through b as super_b { through 
>><class> as <identifier> }*
>>...
>>end
>>
> 
> 
> isn't multiple inheritance enougth for this ?
> 
> class c =
>   object
>     inherit a as super_a
>     inherit b as super_b
>     method m = super_a # m
>     (* other method are left unchanged *)
>   end
> 
> 

Definitely not. By using multiple inheritance as you 
suggest, class c inherits from class a *twice*, thereby 
having double copies of all instance variables declared in 
a. This is bad. Consider how difficult it is to manage a 
multiple-path inheritance in C++, and how that has rendered 
necessary the use of "virtual" memember objects.

Alex

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners