Contact is obvious, three are ' class ', if the reader is not clear about the concept of the class, you can refer to Wid blog post http://www.cnblogs.com/mr-wid/archive/2013/02/18/2916309.html.
The following emphasis on explaining the difference, but this article is only a personal understanding, if you think I said the wrong place, please enlighten.
(1) Structural differences:
General class: Data + method + implementation
Abstract class: Data + method (must contain virtual method N>=1) + partial method implementation
Interface class: Method (pure virtual method)
(2) Conceptual differences:
The difference between the ordinary class and the other two is obvious, the ordinary class is the cat and the dog and so on, and the abstract class is the animal class. But the difference between the interface class and the abstract class is less obvious, so let's talk about these two classes.
The interface class is a special abstract class (pure virtual method and abstract class without data) separated from abstract class, the abstract class focuses on the ' class ' angle, while the interface class focuses on ' method '. In the words of "Big talk design Mode", "class is an abstraction of an object, an abstract class is an abstraction of a class, and an interface is an abstraction of the behavior." ”
For example, cats, dogs (ordinary concrete classes) inherit from the Animal class (abstract class), and cats, dogs and the common "eat" behavior, at this time, we can write a ' eat ' interface class, let the cat, dog class inherit and implement this method.
Abstract class is found from the subclass of the common thing to generalize out of the parent class, so that the child class inherits the parent class, but you do not necessarily know the existence of the subclass when writing the interface class, but like ' eat ' like, must be, just the specific sub-class how to realize what the sub-class is, the cat eat fish, dog chew bones The method of eating ' is implemented in subclasses.
Look at the "Big Talk Design Model" when summed up, if not understand, you can go straight to see the book Appendix A.
class, abstract base class, interface class The difference between the three and the connection (C + +)