I could have swore somebody told me DotNet was MULTIPLE inheritance, where you could have multiple parents...which I thought was really great & cool! However, my Pluralsight training video just said it's SINGLE inheritance.
So what language has MULTIPLE PARENT inheritance? Java?
On May 17, 2017, at 6:44 PM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
So what language has MULTIPLE PARENT inheritance? Java?
Java does. Python too.
-- Ed Leafe
--- StripMime Report -- processed MIME parts --- multipart/signed text/plain (text body -- kept) application/pgp-signature ---
On 2017-05-18 00:06, Ed Leafe wrote:
On May 17, 2017, at 6:44 PM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
So what language has MULTIPLE PARENT inheritance? Java?
Java does. Python too.
Maybe it was Python learning. I did start reading a Java book but I don't think it was that. Wherever it was, I recall reading that the classes listed earlier (left) had dominance over those listed after, so if both class parents had the same method (or was it property?), whichever class was listed first (leftmost) would be the one that got called/referenced.
On May 18, 2017, at 6:33 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
Maybe it was Python learning. I did start reading a Java book but I don't think it was that. Wherever it was, I recall reading that the classes listed earlier (left) had dominance over those listed after, so if both class parents had the same method (or was it property?), whichever class was listed first (leftmost) would be the one that got called/referenced.
Exactly. When you call a method not defined in the current class, it will look it up from the super classes in order until the method is found.
-- Ed Leafe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
On 2017-05-18 08:44, Edward Leafe wrote:
On May 18, 2017, at 6:33 AM, mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
Maybe it was Python learning. I did start reading a Java book but I don't think it was that. Wherever it was, I recall reading that the classes listed earlier (left) had dominance over those listed after, so if both class parents had the same method (or was it property?), whichever class was listed first (leftmost) would be the one that got called/referenced.
Exactly. When you call a method not defined in the current class, it will look it up from the super classes in order until the method is found.
In Java, Python, or both?
I could have swore somebody told me DotNet was MULTIPLE inheritance, where you could have multiple parents...which I thought was really great & cool!
Multiple inheritance of interfaces, but only one actual parent class...
class Class : Parent, Interface1, Interface2, Interface3 { }
I'd argue that there is a good reason not to support multiple inheritance as that easily leads to violations of the Single Responsibility Principle.
On 2017-05-18 03:17, Wollenhaupt, Christof wrote:
I could have swore somebody told me DotNet was MULTIPLE inheritance, where you could have multiple parents...which I thought was really great & cool!
Multiple inheritance of interfaces, but only one actual parent class...
class Class : Parent, Interface1, Interface2, Interface3 { }
I'd argue that there is a good reason not to support multiple inheritance as that easily leads to violations of the Single Responsibility Principle.
-- Christof
Ah...but tell me, can you call to the parent's parent class, like VFP's class::JumpMoreThanOneLevelUp?
You make a good point of the Single Responsibility Principle, though. Less confusing and more consistent.
Ah...but tell me, can you call to the parent's parent class, like VFP's class::JumpMoreThanOneLevelUp?
If you are not talking about a virtual method, you can use
(this as GreatGrandParent).Method();
when Method is either protected internal, internal or public. For a virtual method you cannot skip a level using the base keyword, nor can you for protected methods.
Why would you need, though?
Keep in mind, that in .NET protection and overriding is done at the class level, whereas in VFP it's at the object level. That means, in VFP you can't access protected members of another instance, in C# you can. In VFP you can nest objects through inheritance and composition (containership) which you can't in .NET.
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
On 2017-05-18 08:22, Wollenhaupt, Christof wrote:
Ah...but tell me, can you call to the parent's parent class, like VFP's class::JumpMoreThanOneLevelUp?
If you are not talking about a virtual method, you can use
(this as GreatGrandParent).Method();
when Method is either protected internal, internal or public. For a virtual method you cannot skip a level using the base keyword, nor can you for protected methods.
Why would you need, though?
Keep in mind, that in .NET protection and overriding is done at the class level, whereas in VFP it's at the object level. That means, in VFP you can't access protected members of another instance, in C# you can. In VFP you can nest objects through inheritance and composition (containership) which you can't in .NET.
Can you elaborate on the last part, about nesting objects through inheritance and composition?
Are you doing anything in C#? I am also learning. I have made one form using winforms and trying to understand the concepts. However I am yet to understand how to design the classes or each master dbf will be a class.
Ajoy Khaund
On Thu, May 18, 2017 at 5:14 AM, < mbsoftwaresolutions@mbsoftwaresolutions.com> wrote:
I could have swore somebody told me DotNet was MULTIPLE inheritance, where you could have multiple parents...which I thought was really great & cool! However, my Pluralsight training video just said it's SINGLE inheritance.
So what language has MULTIPLE PARENT inheritance? Java?
[excessive quoting removed by server]
C++ give it to you. VB nope, nor C++. With .Net you can write that small segment of code in any language and call it from your base code.
Why would you want to do it is my question?
Animal Dog Cat Some hybrid of the two?
On Wed, May 17, 2017 at 6:44 PM, < mbsoftwaresolutions@mbsoftwaresolutions.com> wrote:
I could have swore somebody told me DotNet was MULTIPLE inheritance, where you could have multiple parents...which I thought was really great & cool! However, my Pluralsight training video just said it's SINGLE inheritance.
So what language has MULTIPLE PARENT inheritance? Java?
[excessive quoting removed by server]
On Mon, 22 May 2017, at 03:07 PM, Stephen Russell wrote:
Why would you want to do it is my question?
I would say being able to implement multiple interfaces as in C# is perfect for almost any use case and various design patterns using interfaces would cover any unlikely situations where multiple inheritance would be a good idea.
On 2017-05-22 10:07, Stephen Russell wrote:
C++ give it to you. VB nope, nor C++. With .Net you can write that small segment of code in any language and call it from your base code.
Why would you want to do it is my question?
AnimalDog Cat Some hybrid of the two?
I just heard that during my latest PluralSight C# training. I thought DotNet was multi-parent inheritance. Turns out that's Java and Python.