J
josh
Hi I don't well understand if
I have
class Test
{
public:
Test(int i){ val=i;}
int double_val() { return val+val;}
int val;
};
then
Test t1(10), t2(100);
// seems static variable...............
data = &Test::val;
func = &Test::double_val;
// how can t1.*data AND t2.*data know the diferent address if data
contains
// only &Test::val ??????????
cout << "t1 data " << t1.*data << " t2 data " << t2.*data << endl;
the compiler print correctly the differents values ... but how is
possible if
I pass in data only that val address ???
Tanks
I have
class Test
{
public:
Test(int i){ val=i;}
int double_val() { return val+val;}
int val;
};
then
Test t1(10), t2(100);
// seems static variable...............
data = &Test::val;
func = &Test::double_val;
// how can t1.*data AND t2.*data know the diferent address if data
contains
// only &Test::val ??????????
cout << "t1 data " << t1.*data << " t2 data " << t2.*data << endl;
the compiler print correctly the differents values ... but how is
possible if
I pass in data only that val address ???
Tanks