问个类声明问题

5204711353 5204711353 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <iostream.h>
class stock
{
private:
int h;
fun()
{
cout<<"sdada\n";
}
protected:
int f;
public:
int x;
stock(int a=0)
{
f=a;
h=a+1;
}
j()
{
cout<<"kd"<<endl;
}
};
class stockplus :public stock
{
private:
int i;
stock h;
public :

int x;
show()
{
h.j();
cout<<i<<endl<<f<<endl;
f++;
cout<<f<<endl;
x=2;
cout<<x;

}
win()
{
cout<<"win"<<endl;
}
stockplus::stockplus(int a=0) :stock(a),i(21){ }
};

int main()
{
stockplus y;
y.show();
}
在stockplus类中定义拉stock h!所以h可以在类中调用stock的共有方法!
但是我为什么不可以在stock h这一行下断点检测他是否调用拉构造函数呢?
系统不可以把断点下在这里!
后来我在stockplus类中公有的部分定义拉stock h,
为什么不可以在main()这个函数里面用h直接调用stock类的方法呢?
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
5204711353
C++ 语言 65,213 成员 250,513 内容