<分区>
我有一个父类、一个子类,在这个子类中我定义了一些结构。在这个结构中,我想调用父方法。可能吗?
class Parent
{
public:
int foo(int x);
}
class Child : public Parent
{
public:
struct ChildStruct {
int x;
int bar(int y) {
return GET_CLASS_CHILD->foo(this->x + y);
}
};
}
在 C++ 中有这样的可能吗?那怎么实现呢?