interface
were primarily made popular by Java.
Below are the nature of interface
and its C++ equivalents:
interface
can contain only body-less abstract methods; C++ equivalent is pure virtual
methods, though they can/cannot have bodyinterface
can contain only static final
data members; C++
equivalent is static const
data members which are
compile time constantsinterface
can be implement
ed by a Java class
, this
facility is needed because a Java class
can inherit only 1
class
; C++ supports multiple inheritance straight away with help of virtual
keyword when neededBecause of point 3 interface
concept was never formally introduced in C++. Still one can have a flexibility to do that.
Besides this you can refer Bjarne's FAQ on this topic.