= operator in function prototype [duplicate]
Possible Duplicate:
Pure virtual functions may not have an inline definition. Why?
I've come accross a function prototype that looks like this:
virtual void functionN开发者_C百科ame(const int x) = 0;
what does that =0 exactly mean?
This denotes purely virtual (abstract) function. Class containing such function is automatically abstract and any class deriving from it you want to instantiate must implement this function.
It means that this function is pure virtual and won't be implemented in this class. Also this means that the class is an abstract one because it contains a pure virtual function. So you can not make instances of classes that contain pure virtual functions.
It means that function is abstract, with out any implementation, and you have to implement this function in derived class.
This means that functionName
is a pure virtual method. That is, the class does not provide an implementation for the method, subclasses need to implement it.
This is often used for base classes that want to define a method that every subclass needs to implement and for which no meaningful default can be provided.
精彩评论