64,648
社区成员
发帖
与我相关
我的任务
分享
class BASE
{
public:
};
class Derived : private BASE //换成protected也一样
{
};
int main()
{
BASE *p = new Derived;//为什么派生类的指针不能给基类
}
class BASE
{
public:
int a;
};
class Derived : public BASE //换成protected也一样
{
public:
int b;
};
class BASE
{
public:
int a;
};
class Derived : private BASE //换成protected也一样
{
public:
int b;
};
BASE *p = static_cast(BASE *)new Derived;//为什么派生类的指针不能给基类