Hi everyone. I am not sure where to locate this error. I have a small primitive command derived from MstnPrimitiveTool in V8 and I am trying to convert it to V10. Do you have any suggestions?
TIA Volker
What I have done:
I replaced MstnPrimitiveTool with DgnPrimitiveTool and renamed the methods to underline + On…. etc.
The compiler seems to be satisfied with header and c++ file.
Source h-file:
class CabtoolCmdKeil : DgnPrimitiveTool
{
protected:
DPoint3d _aPoints[5];
UInt32 _ulAnzPunkt;
private:
MSElementDescrP _pZellDscr;
Int64 _llcmdNumber;
public:
CabtoolCmdKeil(Int64 cmdNumber, int cmdNameID, int cmdPromptID);
~CabtoolCmdKeil();
virtual bool _OnInstall() override;
virtual void _OnPostInstall() override;
virtual void _OnCleanup() override;
virtual void _OnRestartTool() override;
virtual void _OnReinitialize() override;
virtual void OnComplexDynamics(DgnButtonEventCR ev);
virtual bool _OnResetButton(DgnButtonEventCR ev) override
_OnReinitialize(); return true;
}
virtual bool _OnDataButton(DgnButtonEventCR ev) override;
void MyInstallTool(void);
bool _CreateElement(EditElementHandleR eeh);
};
But I got this error C2248 here:
Source c++file:
static void cmdABKeil(WCharCP wszUnParsed)
CabtoolCmdKeil* pTool = new CabtoolCmdKeil(CMD_ABDATE_KEIL, MESSAGELISTID_Commands_Keil, MESSAGELISTID_Prompts_Keil);
pTool->MyInstallTool();
The Error message:
my.cpp(143) : error C2248: 'Bentley::RefCounted<Bentley::IRefCounted>::operator new' : cannot access protected member declared in class 'Bentley::RefCounted<Bentley::IRefCounted>'
…\include\Bentley/RefCounted.h(91) : see declaration of 'Bentley::RefCounted<Bentley::IRefCounted>::operator new'
my.cpp(143) : error C2248: 'Bentley::RefCounted<Bentley::IRefCounted>::operator delete' : cannot access protected member declared in class 'Bentley::RefCounted<Bentley::IRefCounted>'
…\include\Bentley/RefCounted.h(91) : see declaration of 'Bentley::RefCounted<Bentley::IRefCounted>::operator delete'
Protected functions can't be called from outside of the class or its friends.
Add a static member function like:
class MyTool : DgnPrimitiveTool { private: MyTool(whatever args); public: static RefCountedPtr<MyTool> Create(whatever args) { return new MyTool(args); } };
Or make your MyInstallTool() static and have it allocate the tool internally.
Regards,
Paul
Answer Verified By: Volker Hüfner
Mit freundlichen Grüßen / Best regards Volker Hüfner
| AB_DATE Engineering Software | ab-date.de |