Thus, when you create a Delphi style class, you are permitted to use multiple inheritance, but only if all of the base classes except the one that is a RTL or Delphi style class have no data members and only pure virtual methods. In C++Builder, the compiler recognizes classes that have only pure virtual methods and no data members as corresponding to Delphi interfaces. This allows polymorphic behavior for classes that share the same interface, even if they do not have a common ancestor. Delphi code can assign a class instance to variables of any of those interface types, just as it can assign the class instance to a variable of any ancestor class type. While an Delphi class can have only a single parent class, it can support any number of interfaces. That is, an interface is like a class where all the methods are pure virtual and there are no data members. An Delphi interface acts like a class with no implementation. There is no C++ construct that maps directly to the Delphi concept of interface. Using Interfaces Instead of Multiple Inheritanceįor many of the situations where you would use multiple inheritance in C++, Delphi code makes use of interfaces instead. 5 Interfaced classes and lifetime management.4 Creating classes that support IUnknown.1 Using Interfaces Instead of Multiple Inheritance.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |