?
Solved

Multiple inheritance

Posted on 2002-04-09
9
Medium Priority
?
348 Views
Last Modified: 2010-04-04
Is there a way to implement multiple inheritance in Delphi?
0
Comment
Question by:barzangy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6928120
what does you mean with multiple inheritance?
0
 
LVL 3

Accepted Solution

by:
raidos earned 200 total points
ID: 6928138
The VCL does NOT support multiple inheritance, unless your working with Interfaces...

Regards
//raidos
0
 

Author Comment

by:barzangy
ID: 6928142
Well in c++ you have

class first {
  public void do1();
}

class second {
  public void do2();
}

class third : public first, public second {
}

Here class third inherits both "do1" and "do2"
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:barzangy
ID: 6928147
Raidos: Do you mean it is possible to do that using interfaces? and if yes, can you show one example?
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 6928203
There is no multiple inheritance in Delphi (just like in Java, C# and most other OOP languages). An interface declares what functionality is suported by a class. So, for your example, you can define bot do1 and do2 as interfaces and have one class implement both interfaces. This will work and provide the wanted functionality.
0
 
LVL 3

Expert Comment

by:lopem
ID: 6928737
barzangy,

I dont know how multiple inheritance can improve code. Can you give me an example? I know C++ has multiple inheritance. Delphi doesnt.

best regards.
Manuel Lopez (lopem)
0
 
LVL 3

Expert Comment

by:SteveWaite
ID: 6928854
sorry, look at com lesson 3 in that link i posted
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 6929023

A good example of 'mi' using COM interfaces (if you have the source) is in the OleCtnrs.pas file (TOleContainer). The TOleContainer inherits from multiple COM classes. As the others have mentioned, Delphi itself does not support 'mi using Delphi class objects.

ie: type foo1 = class(TObject, IUnknown, IEtc..) // OK
    type foo2 = class(TObject, TStringList) // NOT OK

-------
Russell
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question