English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
C++/C# inheritance is bad?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-01-17 (13:23)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] C++/C# inheritance is bad?
On Friday 16 January 2009 15:18:50 Kuba Ober wrote:
> So, when correctly applied, what's so disturbing about inheritance?

Inheritance is disturbing because, in general, it cannot be applied correctly. 
That is why there are so many workarounds, many of which do not even exist in 
C++ like final methods, sealed classes, multimethods, extractors and so on. 
OO is not good in all circumstances and other tools can be preferable. IME, 
OO is only very rarely the best solution and it is only chosen so often 
because it is typically the only solution available (e.g. in C++ or Java).

> You inherit only where it makes sense, and if it makes sense then you don't
> care about which particular method is called: it's supposed to be safe.

Safety is quite different from easy of use, of course.

Dr Jon Harrop, Flying Frog Consultancy Ltd.