- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ interview questions on virtual function and abstract class
45 Lectures 4.5 hours
66 Lectures 5.5 hours
What is a virtual function?
A virtual function is a method that does not have a definition when defined in the base class. This method is left black in the parent class and it is redefined in the child class.
What is an abstract class?
An abstract class is a class that has abstract members or at least one pure virtual function in its definition. An abstract class can never be instanced (creating an object). It can only be inherited and the methods could be overwritten.
Can there be any virtual Destructors?
Yes, These are legal in C++, but these are destructors are for base class instead of the child class.
Does every virtual function need to be overridden?
No, It is not always mandatory to redefine a virtual function. It can be used as it is in the base class.
Can we have a constructor as Virtual?
Constructors cannot be virtual, because they need to be defined in the class.
- Java Interview Questions on Constructors
- Java interview questions and answers
- C++ Interview questions based on constructors/ Destructors
- Best Java interview questions
- Core Java interview questions
- Commonly Asked C++ Interview Questions
- Top QA Interview Questions & Answers
- Any good resource for java interview questions
- How to answer Top Java interview questions
- Top Automation Testing Interview Questions & Answers
- Top Database Testing Interview Questions & Answers
- Top Software Testing Interview Questions & Answers
- Pure Virtual Functions and Abstract Classes in C++
- What are some good sites for Java interview questions
- Which is the best site for Java interview questions?