C++ 从继承的类调用具有此指针的方法将变为常量

C++ 从继承的类调用具有此指针的方法将变为常量,c++,gcc,compiler-construction,C++,Gcc,Compiler Construction,在以下示例中,我得到以下错误: 错误:没有用于调用的匹配函数 至'C::C(B*const)' 我不想在这个调用中获得A指针,但由于某种原因我无法通过它。可能是一些愚蠢的打字错误,但由于它是Rhapsody生成的,我真的觉得我无法控制为什么在编译时会出现这个问题 正在尝试添加另一个headerfile。它不会编译,因为需要包含太多的文件,但这是实际执行的代码(更改的类名),并且底层类正在工作 class A { } class B : public A { doSomething {

在以下示例中,我得到以下错误:

错误:没有用于调用的匹配函数 至'C::C(B*const)'

我不想在这个调用中获得A指针,但由于某种原因我无法通过它。可能是一些愚蠢的打字错误,但由于它是Rhapsody生成的,我真的觉得我无法控制为什么在编译时会出现这个问题

正在尝试添加另一个headerfile。它不会编译,因为需要包含太多的文件,但这是实际执行的代码(更改的类名),并且底层类正在工作

class A { }
class B : public A { 
    doSomething {
        C * c = new C(this);
    }
}
class C
{
    C(A* copy);
}
\ifndef A\u H
#定义一个
//##自动生成
#包括
//##自动生成
#包括“TestSequencePkg.h”
//##自动生成
#包括
//##自动生成
#包括
//##自动生成
#包括
//##甲级
#包括“D.h”
//##依赖项F
#包括“F.h”
//##甲级
#包括“C.h”
//##依赖关系G
#包括“G.h”
//##甲级
#包括“B.h”
//##甲级
#包括“E.h”
//##操作A(TestContextC*)
类TestContextC;
//##包TestSequencePkg
//##甲级
甲级:公有制、公有制B、公有制C、公有制D、公有制E{
////构造函数和析构函数////
公众:
//##操作A(TestContextC*)
A(TestContextC*context,IOxfActive*theActiveContext=0);
//##自动生成
A(IOxfActive*theActiveContext=0);
//##操作~A()
~A();
////操作////
//##操作handleInMessage(AFBaseMsgC*)
虚拟ACE_UINT32 handleInMessage(AFBaseMsgC*msg);
//##操作init()
虚拟void init();
////附加操作////
//##自动生成
虚拟bool startBehavior();
受保护的:
//##自动生成
void initStatechart();
////框架操作////
公众:
//根状态:
//##状态图法
inline bool rootState_IN()常量;
//##状态图法
内联bool rootState_isCompleted();
//##状态图法
虚拟void rootState_entDef();
//##状态图法
void rootState_exit();
//##状态图法
虚拟IOxfReactive::TakeEventStatus rootState_processEvent();
//更新数据:
//##状态图法
inline bool UpdateData_IN()常量;
//终端状态4:
//##状态图法
内联布尔终端state_4_IN()常数;
//CalculateFiringData:
//##状态图法
inline bool CalculateFiringData_IN()常量;
//书架:
//##状态图法
内联bool BookShell_IN()常量;
////框架////
受保护的:
//#[忽略
枚举测试序列弹道计算枚举{
OMNonState=0,
UpdateData=1,
终端状态_4=2,
CalculateFiringData=3,
BookShell=4
};
int rootState_subState;
int rootState_active;
//#]
};
内联布尔A::rootState_IN()常量{
返回true;
}
内联bool A::rootState_isCompleted(){
返回(在(终止状态4)中);
}
内联布尔A::UpdateData_IN()常量{
返回rootState_subState==UpdateData;
}
内联布尔A::terminationstate_4_IN()常量{
返回rootState_subState==terminationstate_4;
}
内联布尔A::CalculateFilingData_IN()常量{
返回rootState_subState==CalculateFilingData;
}
内联bool A::BookShell\u IN()常量{
返回rootState_subState==BookShell;
}
#恩迪夫
这是cpp文件

#ifndef A_H
#define A_H

//## auto_generated
#include <oxf/oxf.h>
//## auto_generated
#include "TestSequencePkg.h"
//## auto_generated
#include <oxf/omreactive.h>
//## auto_generated
#include <oxf/state.h>
//## auto_generated
#include <oxf/event.h>
//## class A
#include "D.h"
//## dependency F
#include "F.h"
//## class A
#include "C.h"
//## dependency G
#include "G.h"
//## class A
#include "B.h"
//## class A
#include "E.h"
//## operation A(TestContextC *)
class TestContextC;

//## package TestSequencePkg

//## class A
class A : public OMReactive, public B, public C, public D, public E {
    ////    Constructors and destructors    ////

public :

    //## operation A(TestContextC *)
    A(TestContextC * context, IOxfActive* theActiveContext = 0);

    //## auto_generated
    A(IOxfActive* theActiveContext = 0);

    //## operation ~A()
    ~A();

    ////    Operations    ////

    //## operation handleInMessage(AFBaseMsgC *)
    virtual ACE_UINT32 handleInMessage(AFBaseMsgC * msg);

    //## operation init()
    virtual void init();

    ////    Additional operations    ////

    //## auto_generated
    virtual bool startBehavior();

protected :

    //## auto_generated
    void initStatechart();

    ////    Framework operations    ////

public :

    // rootState:
    //## statechart_method
    inline bool rootState_IN() const;

    //## statechart_method
    inline bool rootState_isCompleted();

    //## statechart_method
    virtual void rootState_entDef();

    //## statechart_method
    void rootState_exit();

    //## statechart_method
    virtual IOxfReactive::TakeEventStatus rootState_processEvent();

    // UpdateData:
    //## statechart_method
    inline bool UpdateData_IN() const;

    // terminationstate_4:
    //## statechart_method
    inline bool terminationstate_4_IN() const;

    // CalculateFiringData:
    //## statechart_method
    inline bool CalculateFiringData_IN() const;

    // BookShell:
    //## statechart_method
    inline bool BookShell_IN() const;

    ////    Framework    ////

protected :

//#[ ignore
    enum TestSequenceBallisticCalcC_Enum {
        OMNonState = 0,
        UpdateData = 1,
        terminationstate_4 = 2,
        CalculateFiringData = 3,
        BookShell = 4
    };

    int rootState_subState;

    int rootState_active;
//#]
};

inline bool A::rootState_IN() const {
    return true;
}

inline bool A::rootState_isCompleted() {
    return ( IS_IN(terminationstate_4) );
}

inline bool A::UpdateData_IN() const {
    return rootState_subState == UpdateData;
}

inline bool A::terminationstate_4_IN() const {
    return rootState_subState == terminationstate_4;
}

inline bool A::CalculateFiringData_IN() const {
    return rootState_subState == CalculateFiringData;
}

inline bool A::BookShell_IN() const {
    return rootState_subState == BookShell;
}

#endif
自动生成 #包括 //##自动生成 #包括“A.h” //##操作handleInMessage(AFBaseMsgC*) #包括“AFBaseMsgC.h” //##事件evTestSuccess() #包括“TestBasePkg.h” //##操作A(TestContextC*) #包括“TestContextC.h” //##包TestSequencePkg //##甲级 A::A(TestContextC*上下文,IOxfActive*活动文本):B(上下文){ setActiveContext(ActiveContext,false); initStatechart(); //#[操作A(TestContextC*) //#] } A::A(IOxfActive*活动文本){ setActiveContext(ActiveContext,false); initStatechart(); } A::~A(){ //#[行动~A() //#] } ACE_UINT32 A::handleInMessage(AFBaseMsgC*msg){ //#[操作手册信息(AFBaseMsgC*) 返回getState(); //#] } void A::init(){ //#[操作初始化() 开始行为(); //#] } bool A::startBehavior(){ bool done=false; done=OMReactive::startBehavior(); 已完成的返回; } void A::initStatechart(){ rootState_subState=OMNonState; rootState_active=OMNonState; } void A::rootState_entDef(){ { rootState_subState=BookShell; rootState_active=BookShell; //#[state ROOT.BookShell.(条目) 注册程序(新的F(这个,这个,这个)); //#] } } void A::rootState_exit(){ 开关(根状态\子状态){ 案例更新数据: { popNullTransition(); 打破 } 违约: 打破 } rootState_subState=OMNonState; } IOxfReactive::TakeEventStatus A::rootState_processEvent(){ IOxfReactive::TakeEventStatus res=eventNotConsumed; 开关(根状态\激活){ 案例书架: { if(事件类型为(evTestSuccess\TestBasePkg\u id)) { rootState_subState=CalculateFilingData; rootState_active=CalculateFiringData; //#[状态根目录.CalculateFilingData.(输入) 注册程序(新的G(这个,这个,这个,这个)); //#] res=消耗的事件; } else if(事件类型是否为(evTestFailure\TestBasePkg\U id)) { //#[过渡4 设置状态(中止); //#] rootState_subState=terminationstate_4; rootState_active=terminationstate_4; res=消耗的事件; } 打破 } 案例计算
//## auto_generated
#include <oxf/omthread.h>
//## auto_generated
#include "A.h"
//## operation handleInMessage(AFBaseMsgC *)
#include "AFBaseMsgC.h"
//## event evTestSuccess()
#include "TestBasePkg.h"
//## operation A(TestContextC *)
#include "TestContextC.h"
//## package TestSequencePkg

//## class A
A::A(TestContextC * context, IOxfActive* theActiveContext) : B(context) {
    setActiveContext(theActiveContext, false);
    initStatechart();
    //#[ operation A(TestContextC *)
    //#]
}

A::A(IOxfActive* theActiveContext) {
    setActiveContext(theActiveContext, false);
    initStatechart();
}

A::~A() {
    //#[ operation ~A()
    //#]
}

ACE_UINT32 A::handleInMessage(AFBaseMsgC * msg) {
    //#[ operation handleInMessage(AFBaseMsgC *)
    return getState();
    //#]
}

void A::init() {
    //#[ operation init()
    startBehavior();
    //#]
}

bool A::startBehavior() {
    bool done = false;
    done = OMReactive::startBehavior();
    return done;
}

void A::initStatechart() {
    rootState_subState = OMNonState;
    rootState_active = OMNonState;
}

void A::rootState_entDef() {
    {
        rootState_subState = BookShell;
        rootState_active = BookShell;
        //#[ state ROOT.BookShell.(Entry) 
        registerProcedure(new F(this, this, this));
        //#]
    }
}

void A::rootState_exit() {
    switch (rootState_subState) {
        case UpdateData:
        {
            popNullTransition();
            break;
        }

        default:
            break;
    }
    rootState_subState = OMNonState;

}

IOxfReactive::TakeEventStatus A::rootState_processEvent() {
    IOxfReactive::TakeEventStatus res = eventNotConsumed;
    switch (rootState_active) {
        case BookShell:
        {
            if(IS_EVENT_TYPE_OF(evTestSuccess_TestBasePkg_id))
                {
                    rootState_subState = CalculateFiringData;
                    rootState_active = CalculateFiringData;
                    //#[ state ROOT.CalculateFiringData.(Entry) 
                    registerProcedure(new G(this, this, this, this));
                    //#]
                    res = eventConsumed;
                }
            else if(IS_EVENT_TYPE_OF(evTestFailure_TestBasePkg_id))
                {
                    //#[ transition 4 
                    setState(ABORTED);
                    //#]
                    rootState_subState = terminationstate_4;
                    rootState_active = terminationstate_4;
                    res = eventConsumed;
                }

            break;
        }
        case CalculateFiringData:
        {
            if(IS_EVENT_TYPE_OF(evTestSuccess_TestBasePkg_id))
                {
                    pushNullTransition();
                    rootState_subState = UpdateData;
                    rootState_active = UpdateData;
                    res = eventConsumed;
                }
            else if(IS_EVENT_TYPE_OF(evTestFailure_TestBasePkg_id))
                {
                    //#[ transition 3 
                    setState(ABORTED);
                    //#]
                    rootState_subState = terminationstate_4;
                    rootState_active = terminationstate_4;
                    res = eventConsumed;
                }

            break;
        }
        case UpdateData:
        {
            if(IS_EVENT_TYPE_OF(OMNullEventId))
                {
                    //## transition 5 
                    if(true == isNextFmAvailable())
                        {
                            popNullTransition();
                            //#[ transition 5 
                            populateNextFm();
                            //#]
                            rootState_subState = CalculateFiringData;
                            rootState_active = CalculateFiringData;
                            //#[ state ROOT.CalculateFiringData.(Entry) 
                            registerProcedure(new G(this, this, this, this));
                            //#]
                            res = eventConsumed;
                        }
                    else
                        {
                            //## transition 6 
                            if(false == isNextFmAvailable())
                                {
                                    popNullTransition();
                                    //#[ transition 6 
                                    setState(COMPLETED);
                                    //#]
                                    rootState_subState = terminationstate_4;
                                    rootState_active = terminationstate_4;
                                    res = eventConsumed;
                                }
                        }
                }

            break;
        }

        default:
            break;
    }
    return res;
}
:3: error: function definition does not declare parameters
:10: error: expected unqualified-id at end of input
class A { };
class C
{
public:
    C(A* copy);
};
class B : public A {
    void doSomething() {
        C * c = new C(this);
    }
};