Why pure virtual functions are used if they don't have implementation / When does a pure virtual function become useful?
A pure virtual function makes it so the base class can not be instantiated, and the derived classes are forced to define these functions before they can be instantiated. This helps ensure the derived classes do not forget to redefine functions that the base class was expecting them to.
| Is This Answer Correct ? | 0 Yes | 0 No |
Can we declare destructor as static? Explain?
How is computer programming useful in real life?
Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data [222] through data [321].
What are the two shift operators and what are their functions?
Can notepad ++ run c++?
what is an array
What is the array and initializing arrays in c++?
What is binary object model?
how many trys can we write in one class
Is java the same as c++?
what are prototypes
class X { public: int x; static void f(int z); }; void X::f(int y) {x=y;} What is the error in the sample code above? a) The class X does not have any protected members. b) The static member function f() accesses the non-static z. c) The static member function f() accesses the non-static x. d) The member function f() must return a value. e) The class X does not have any private members.