abstract methods |
Top Previous Next |
What is translated > Types > Records, Classes, Interfaces > Class > abstract methods Like Delphi also C++ knows abstract methods. The most natural way of translation is for example:
function Get(Index: Integer): Integer; virtual; abstract; -> virtual int __fastcall Get(int Index) = 0;
But opposed to Delphi. in C++ no objects can be created from classes with abstract methods. A C++ compiler even complains about the code at compile time. At development time sometimes it's practical, that such code compiles and runs in C++ too. Therefore Delphi2Cpp has the option to create minimal function bodies for abstract functions. The example becomes to:
virtual int __fastcall Get(int Index){return 0;} // = 0;
Of course, this option should be used temporarily only.
|
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |