Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualThe King2

Posted 04 April 2013 - 10:15 AM

C++ has no notion of what an interface is. In C++, there are just classes and structs (which are, effectively, the same thing), and they all work the same. A class with only pure virtual functions isn't "special" from a class that has no virtual functions. "Interfaces" are an idea from other languages, like Java and C#, and the closest thing to an interface in C++ is a class with only pure virtual functions (but again, it's just a normal class; it's not "special").

 

True that, I should mind my wording, I actually meant interface in the sense of those pure virtual classes - I've been recently tought that concept in my c++ class, and been told I wouldn't need a destructor. Thanks still for the explanation.

 

As for the "pure virtual destructor", the headline was meant to read "Pure virtual base class: destructor", my bad...


#1The King2

Posted 04 April 2013 - 09:48 AM

C++ has no notion of what an interface is. In C++, there are just classes and structs (which are, effectively, the same thing), and they all work the same. A class with only pure virtual functions isn't "special" from a class that has no virtual functions. "Interfaces" are an idea from other languages, like Java and C#, and the closest thing to an interface in C++ is a class with only pure virtual functions (but again, it's just a normal class; it's not "special").

 

True that, I should mind my wording, I actually meant interface in the sense of those pure virtual classes - I've been recently tought that concept in my c++ class, and been told I wouldn't need a destructor. Thanks still for the explanation.


PARTNERS