When inheriting a virtual class, be careful when instantiating it. You must make it fully real and override the pure virtual method... Class Definition location

Source: Internet
Author: User

 

Http://stackoverflow.com/questions/7352706/cannot-allocate-an-object-of-abstract-type-error

In C ++ a class with at least one pure virtual function is calledAbstract classAnd you cannot create objects of that class, you can only have pointers or references to it.

If you are deriving from an abstract class make sure you override and define all pure virtual functions for your class.

 

 

It is because an error is written in a pure virtual method in the inherited base class. The final error is too exaggerated...

 

It is reported that a pure virtual class cannot be instantiated .....

 

In addition, different classes are used to store different files. Otherwise, the relationship between classes and classes is very important.

You can use include to solve the problem of file inclusion ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.