See
Http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20513227.html
Use ATL to add an "ATL simple object" called myobject
In this case, I want to create a new myobject * PTR = new myobject ();)
The following error occurs during compilation: "error c2259 cannot instantiate abstract class ."
The answer here is the feature of pure virtual functions. I think it should be a feature of ATL. I think this is the correct answer:
Comment from yuriputivsky Date: 02/13/2003 0:57 pm PST |
Comment |
|
This is a well-known ATL trick. The right way to create the instance of ATL class is:Ccomclass <yuor_class_name> * pobj = 0; Hresult hR = ccomclass <yuor_class_name>: createinstanCe (& pobj ); // Check error here // Also the good practice to request some interface through QueryInterface function because some internal static data are finally initialized on QueryInterface. |
Change ccomclass to ccomobject.