I have been told that if the decleration of a class member function starts with a virtual
keyword and ends with =0
, then this function would be a virtual function and the class it belongs to would be an abstract class (all member functions are virtual function, then would be an interface). But I also found that some classes are declared with const=0
, but no virtual
keyword.
So I want to know if the following two class are the same? If so, why some use virtual
while others not. If not, then what are their differences?
class class1 {
int function1() const = 0;
int function2() const = 0;
...
};
class class2 {
virtual int function1() const = 0;
virtual int function2() const = 0;
};