问个类声明问题
#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类的方法呢?