Click here to Skip to main content
15,887,135 members

Survey Results

Multiple Inheritence   [Edit]

Survey period: 17 Mar 2002 to 24 Mar 2002

Do you use multiple inheritence when programming?

OptionVotes% 
Yes, I often derive from multiple classes13513.80
Yes, I occasionally derive from multiple classes37638.45
Yes, I use classes that are derived from multiple classes (but don't create these classes myself)909.20
No - I see no need19219.63
No - the language I use doesn't support MI444.50
No - I intentionally avoid MI.14114.42



 
GeneralMI is useful, in same cases Pin
Mauro Gagna18-Mar-02 7:31
Mauro Gagna18-Mar-02 7:31 
Generali use it, but then i feel dirty Pin
Chris Losinger18-Mar-02 2:34
professionalChris Losinger18-Mar-02 2:34 
GeneralRe: i use it, but then i feel dirty Pin
Braulio Dez20-Mar-02 22:56
Braulio Dez20-Mar-02 22:56 
GeneralWTL Pin
CodeGuy18-Mar-02 2:08
CodeGuy18-Mar-02 2:08 
GeneralRe: WTL Pin
Joaquín M López Muñoz18-Mar-02 8:13
Joaquín M López Muñoz18-Mar-02 8:13 
GeneralRe: WTL Pin
CodeGuy18-Mar-02 8:24
CodeGuy18-Mar-02 8:24 
GeneralReal world examples Pin
Michael P Butler17-Mar-02 22:04
Michael P Butler17-Mar-02 22:04 
GeneralRe: Real world examples Pin
Navin18-Mar-02 3:40
Navin18-Mar-02 3:40 
GeneralRe: Real world examples Pin
Chris Losinger18-Mar-02 4:03
professionalChris Losinger18-Mar-02 4:03 
GeneralRe: Real world examples Pin
Jamie Hale18-Mar-02 9:57
Jamie Hale18-Mar-02 9:57 
GeneralRe: Real world examples Pin
Ravi Bhavnani20-Mar-02 5:40
professionalRavi Bhavnani20-Mar-02 5:40 
Maybe I'm in the minority, but I use MI very often. Here's a simple example:

My apps often serialize various kinds of objects which eventually need to be presented to and manipulated by a GUI, typically tree and list controls. The objects are uniquely identified by id's (which happen to be unsigned longs, but that's immaterial) and also have non-unique names.

These objects multiply inherit from IIdentifiable and INamed, which are "interfaces" (i.e. classes with no data members, and whose methods are all pure virtual). My GUI elements know how to display any kind of INamed object because they can get athe object's name by calling getName(). The item data field of each GUI element stores the object's id, retrieved via getId() which is a method of IIdentifiable.

While C# and Java may not allow multiple inheritance, they allow objects to implement any number of interfaces, which is a safe way of exposing multiple behaviors. This is what I've done in the above C++ example.

One should exercise caution before settling on one side of the fence over questions like "do you use MI?" and "do you use gotos". Both concepts can be both used and abused. Smile | :)

/ravi

"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
GeneralDesign Patterns Pin
Braulio Dez20-Mar-02 22:57
Braulio Dez20-Mar-02 22:57 
GeneralWhy avoid it? Pin
Matt Newman17-Mar-02 16:31
Matt Newman17-Mar-02 16:31 
GeneralRe: Why avoid it? Pin
Nish Nishant17-Mar-02 16:46
sitebuilderNish Nishant17-Mar-02 16:46 
GeneralRe: Why avoid it? Pin
Vivek Rajan17-Mar-02 16:51
Vivek Rajan17-Mar-02 16:51 
GeneralRe: Why avoid it? Pin
Ravi Bhavnani17-Mar-02 16:52
professionalRavi Bhavnani17-Mar-02 16:52 
GeneralRe: Why avoid it? Pin
ColinDavies17-Mar-02 18:49
ColinDavies17-Mar-02 18:49 
GeneralRe: Why avoid it? Pin
James T. Johnson17-Mar-02 18:55
James T. Johnson17-Mar-02 18:55 
GeneralRe: Why avoid it? Pin
Uwe Keim17-Mar-02 19:33
sitebuilderUwe Keim17-Mar-02 19:33 
GeneralRe: Why avoid it? Pin
Michael Dunn17-Mar-02 20:46
sitebuilderMichael Dunn17-Mar-02 20:46 
GeneralRe: Why avoid it? Pin
Uwe Keim17-Mar-02 20:53
sitebuilderUwe Keim17-Mar-02 20:53 
GeneralRe: Why avoid it? Pin
Michael Dunn19-Mar-02 18:48
sitebuilderMichael Dunn19-Mar-02 18:48 
GeneralRe: Why avoid it? Pin
Andrew Torrance18-Mar-02 0:04
Andrew Torrance18-Mar-02 0:04 
GeneralRe: Why avoid it? Pin
Tom Archer20-Mar-02 5:17
Tom Archer20-Mar-02 5:17 
GeneralRe: Why avoid it? Pin
Joaquín M López Muñoz21-Mar-02 12:04
Joaquín M López Muñoz21-Mar-02 12:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.