473,760 Members | 9,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple inheritance

why doesn't .NET support multiple inheritance?
I think it's so silly!

Cheers,
Mark
Mar 24 '06 #1
47 3643
Hello Mark,

Why for? .NET support multiple *interface* inheritance

M> why doesn't .NET support multiple inheritance? I think it's so silly!
M>
M> Cheers,
M> Mark
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 24 '06 #2
It's just as silly as Java, which doesn't support multiple inheritance,
either.

Here's a chance for me to learn something (as usual): Is it .NET that
doesn't support multiple inheritance, or just C#? After all, there is a
C++ compiler for .NET, and C++ does support multiple inheritance... so,
can the CLR do it, but it was simply left out of C#, or is it a
limitation of the CLR?

As for why it's not in C#, if you take the trouble to search the
archives of this group you'll find many discussions on why it was left
out or why it should have been included (depending upon the poster's
point of view). There's really no need to go over it all again since
it's all been covered here before, several times. (Unless, of course,
you're bored, and really want to.)

Mar 24 '06 #3
"Mark" <Ma**@discussio ns.microsoft.co m> wrote in message
news:1A******** *************** ***********@mic rosoft.com...
why doesn't .NET support multiple inheritance?
I think it's so silly!


http://www.google.com/search?sourcei...inheritance%22
Mar 24 '06 #4
Hi,

If you look into the archives you will see it has been discussed here
several times before.

In short, having interfaces you do not need the extra complexity that
introduce multiple inheritance
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Mark" <Ma**@discussio ns.microsoft.co m> wrote in message
news:1A******** *************** ***********@mic rosoft.com...
why doesn't .NET support multiple inheritance?
I think it's so silly!

Cheers,
Mark

Mar 24 '06 #5
Mark wrote:
why doesn't .NET support multiple inheritance?
I think it's so silly!


Because it was considered that the few cases where implementation MI is
usefull (especially when you don't have templates to use with MI) weren't
enough considered the implementation complexity and the (high) risk of
misuse of implementation MI.

Arnaud
MVP - VC
Mar 24 '06 #6
"Ignacio Machin

In short, having interfaces you do not need the extra complexity that
introduce multiple inheritance

And don't forget design principle #2: whenever possible, favor composition
over inheritance.

Cheers

Padu
Mar 24 '06 #7
Mark,

You are right. It is silly but more more importantly it severly limits the
ability to combine, in an articulate and elegant manner, functionally
orthogonal processing.

My take on the manner is that 'closed communities' tend to be intellectually
sterile (see summary statement).

In spite of the excellent professionalism of the C# programming community
and the significant contributions of C# (reflection, LINQ, EOP (Event
Observer Pattern)) the core decision making of C# architecture is very, very
small (God Bless Anders!!!).

The argument aganist C# MI (Multiple Iheritance) deals with complexity.

The complexity they speak of is mostly the implementation 'under the covers'
complexity. Of secondary import (in arguments aganist) is the supposed
'complexity' of expression (above the covers). I will drop 'under the covers'
issues and focus on the 'above the covers' issue of WHY (IMHO) MI (multiple
Inheritance) as been rejected by the closed community.

Q. WHY is MI not in C#?
A. Expression complexity

Expression complexity (for lack of a better term) is a most shallow argument
aganist the inclusion of multiple inheritance. When I say 'expression
complexity' I DO NOT MEAN a 30 line contrived example. I mean the 'expressive
complexity' on the order of millons of lines of code, similar in scope to
Lord of the Rings and Sherlock Holmes (If you can't make the leap don't read
further).

Currently in C# we divide and conquer complexity by (1) stratification in
(A) call levels and (B) inheritance. So complexity can be 'layered' from L1
to Ln. Single inheritance can be fitted to the concept of just being another
layer - Li.

In C++ we also have multiple inheritance to divide and conquer complexity by
(2) functionally orthogonal articulation. Thus any Lx (level of
stratifaction) can contain F1 to Fn. So a single class 'inherits' F1 to Fn as
multiple classes via MI. Now the derived class can call embedded classes (the
next LX) and also call or provide (to a caller) F1 to Fn.

SI as Li VS MI as F1 - FN is the core 'sticking point' that divides the
FOR/AGANIST campes.

WHY : THOSE OPPOSED TO C# MI : They say an Lx with F1 -> Fx is to complex.

Their summary statements always say something like 'not worth it' meaning it
brings in more problems than not.

I would tend to agree if every Lx (Level of stratification) had a functional
break out (More than one Fx via more than one parent class via MI). BUT -
IMHO - only 10 to 30 % (a hip shot I admit) of levels in a 'real world'
design have a 'functional breakout'. So I think that MI for functional
decomposition is hetrogenous (and clustered on a few key levels a real world
component design) and not homogenous.

I love MI (Multiple Inheritance). It ONLY simplifies things (above the
covers). More importantly, I believe that a simple implementation (under the
covers) is inherently doable (if I wrote the compiler - I love saying that!
:-). But the core dev team of C# does not (so much for MHO :-)

[BTW - Pipelining and OOA (Object Oriented Approach) do not result in a
'single top node' simplification via language feature sets. Multiple
inheritance, for example, is a code element mechanism that formally produces
a functional focal point (the derived class access and 'pass through' of
multiply inherited function).]

I have the deepest respect and admiration for the Anders/C#Community of
thougth. But I truly believe another solution, post C#, will fill the
programming void of the future caused by this significant and unfortunate
expressive hole (in the fundamental C# architecture).

I think the 'intellectual sterility' (flame me please - I'm asking for it
:-O) resides in the tendency to determine everything (language feature wise)
in a 30 to 40 line contrived example IN C#.

As Einstein said you have to go at least one level 'above' something to talk
about it. So system level arguments (Lx + FX combined as a single point
(classs) via MI) do not carry much weight because they are 'above' that 30 to
40 line intellectual prison of many core community members (MVPs, etc).

So -IMHO - the 'closed community' is formed by the 30 to 40 line mindset.
Like Republican/Democrat dialogs your 'camp' is defined by your values and
comfort zone. Its always nice to know I'm not alone in my 'camp'.

Good luck to you Mark. It's (also) always nice to know someone else is
sharing my pain :-)

shawnk

PS. It always feels 'so good' to get this off my chest. Thanks for the
opportunity.
"Mark" wrote:
why doesn't .NET support multiple inheritance?
I think it's so silly!

Cheers,
Mark

Mar 26 '06 #8
>>It always feels 'so good' to get this off my chest. Thanks for the
opportunity


Thanks. I feel much better too. I knew I wasnt alone. I grew up with MI
and miss it dearly in .NET. Only today to I find myself COPYing code into a
few places because interfaces just cant do what I need.

Radek
Mar 27 '06 #9
"Radek Cerny" <ra*********@NO SPAM.c1s.com.au > a écrit dans le message de
news: ek************* *@TK2MSFTNGP09. phx.gbl...

| Thanks. I feel much better too. I knew I wasnt alone. I grew up with MI
| and miss it dearly in .NET. Only today to I find myself COPYing code into
a
| few places because interfaces just cant do what I need.

Sounds to me you need to use interface implementation by delegation - a much
better paradigm than MI.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Mar 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4338
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
5
2182
by: Morgan Cheng | last post by:
It seems no pattern defined by GoF takes advantage of multiple inheritance. I am wondering if there is a situation where multiple inheritance is a necessary solution. When coding in C++, should multiple inheritance still be avoided? If yes, why multiple inheritance is introducted into C++?
20
10084
by: km | last post by:
Hi all, In the following code why am i not able to access class A's object attribute - 'a' ? I wishto extent class D with all the attributes of its base classes. how do i do that ? thanks in advance for enlightment ... here's the snippet #!/usr/bin/python
22
23383
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete examples?
60
4932
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the 'target' programming community herein) to get some community input and verify (or not) the following two statements. Few programmers (3 to7%) UNDERSTAND 'Strategic Functional Migration
15
28374
by: iKiLL | last post by:
hi all, I would like to be able to create an umbrella class for all my main global sections but I would still like to keep them all in separate file something like the below but I keep getting an error saying you are not allowed Multiple base classes. /// <summary>
7
3740
by: Adam Nielsen | last post by:
Hi everyone, I'm having some trouble getting the correct chain of constructors to be called when creating an object at the bottom of a hierarchy. Have a look at the code below - the inheritance goes like this: Shape | +-- Ellipse | +-- Circle
47
4030
by: Larry Smith | last post by:
I just read a blurb in MSDN under the C++ "ref" keyword which states that: "Under the CLR object model, only public single inheritance is supported". Does this mean that no .NET class can ever support multiple inheritance. In C++ for instance I noticed that the compiler flags an error if you use the "ref" keyword on a class with multiple base classes. This supports the above quote. However, under the "CodeClass2.Bases" property (part...
2
2585
by: Paul McGuire | last post by:
On May 25, 8:37 am, Michael Hines <michael.hi...@yale.eduwrote: Here's a more general version of your testing code, to detect *any* diamond multiple inheritance (using your sample classes). -- Paul for cls in (A,B,C,D): seen = set()
0
9521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9333
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9945
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.