Is this possible ?
class A;
class B;
class A
{
int test;
};
class B
{
void testh(int hehe);
A *tester;
};
void B::testh(int hehe)
{
tester->test = hehe;
}
Is this possible ? and how do i have to inizialize the pointer ? I think its possible, so could you please write a sampe main() function for that showing how i have to use the pointer ?
cYa
I am the Null between One and Two
Edited by - 0_between_1_and_2 on 4/22/00 3:11:21 PM
I am the Null between One and Two
Add
void B::B()
{
tester = new A;
}
and
void B::~B()
{
delete tester;
}
Visit our homepage: www.rarebyte.de.st
GA
void B::B()
{
tester = new A;
}
and
void B::~B()
{
delete tester;
}
Visit our homepage: www.rarebyte.de.st
GA
Visit our homepage: www.rarebyte.de.stGA
You''ll have to do what "ga" said (to use a constructor and destructor), or else don''t use a pointer but rather an instance.
Also "test" is private in class A, so
void B::testh(int hehe)
{
tester->test = hehe;
}
won''t work in the first place, so you need an public access function in class A.
aig
Also "test" is private in class A, so
void B::testh(int hehe)
{
tester->test = hehe;
}
won''t work in the first place, so you need an public access function in class A.
aig
aig
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement