D
David
Hi all,
I am really new in C++. I met a problem. Could someone help me?
I have a base class:
class a
{
protected:
int b;
public:
int getint(){return b;};
setint (int a){ b=a};
};
class bublic a
{
.......
}
class cublic a
{
}
main
{
int k;
b *p1;
c *p2;
p1->setint(3);
k=p2->getint();
}
why the value of k is not 3? please help me. how can do that. thanks
I am really new in C++. I met a problem. Could someone help me?
I have a base class:
class a
{
protected:
int b;
public:
int getint(){return b;};
setint (int a){ b=a};
};
class bublic a
{
.......
}
class cublic a
{
}
main
{
int k;
b *p1;
c *p2;
p1->setint(3);
k=p2->getint();
}
why the value of k is not 3? please help me. how can do that. thanks