C++ Virtual Functions Question:
Download Job Interview Questions and Answers PDF
Do you know what are pure virtual functions?
Answer:
Pure virtual functions are also called 'do nothing functions'.
e.g. virtual void abc() = 0;
When a pure virtual fnction is declared in the base class, the compiler necessitates the derived classes to define those functions or redeclare them are pure virtual functions. The classes containing pure virtual functions cannot be used to declare objects of their own. Such classes are called as abstract base classes.
e.g. virtual void abc() = 0;
When a pure virtual fnction is declared in the base class, the compiler necessitates the derived classes to define those functions or redeclare them are pure virtual functions. The classes containing pure virtual functions cannot be used to declare objects of their own. Such classes are called as abstract base classes.
Download C++ Virtual Functions Interview Questions And Answers
PDF
Previous Question | Next Question |
Explain the problem with overriding functions? | What is general form of pure virtual function? Explain? |