-
super/interface keywords
http://msdn.microsoft.com/library/de.../key_f-r_3.asp
http://msdn.microsoft.com/library/en.../key_s-z_1.asp
I learned object oriented programming with java, and in java super and interface keywords exist. But I've never come across those kewords in a C++ source. Yet.. I have the doubt. Are those keywords standard or only another of VC++ add-ons ?!?
-
Well, that's because C++ doesn't have interfaces--it has multiple inheritance, and calling a base class constructor is not done with super().
-
if I ever need that (big hierarchy tree) I think I'll use
Code:
#undef interface
#ifndef _MSC_VER
#define interface class
#else
#pragma keyword("interface", on)
#endif
-
-
You can have the same effects in C++, but those are not keywords.
If you want an interface, create an abstract data type (which is a class that has pure virtual functions -- although, it can have implemented functions too).
For calling the base class constructor, you must do this in the initializer list.