How Internally compiler identifies wheather class is an abstract (for which we cannot create object)?
How Internally compiler identifies wheather class is an abstract (for which we cannot create
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The compiler is smart enough to check for a pure virtual function in a class or any of the classes it derives from.
If the class itself defines a pure virtual function[Ref 1], it is flagged as Abstract class irrespective of whether it defines the function body.
If a class inherits from a class with pure virtual function then it must provide a definition for the pure virtual function.If not it is flagged as Abstract.
[Ref 1]
P.S: Yes pure virtual functions can have a definition.