L
Larry Lindsey
If I have classes Parent, Child, and Seat as follows
class Parent{
public:
float getValue(){return 0;}
...
}
class Child: public Parent{
public:
float getValue(){return val;}
...
private:
float val;
}
class Seat{
public:
Parent* getPerson(){
return thePerson;
}
void setPerson(Parent *inPerson){
thePerson=inPerson;
}
...
private:
Parent* thePerson;
}
If i do this:
Child *c = new Child();
Seat *s = new Seat();
Child->setValue(12);
s->setPerson(c);
How would I make s->getPerson()->getValue() return 12, and not 0?
--Larry
class Parent{
public:
float getValue(){return 0;}
...
}
class Child: public Parent{
public:
float getValue(){return val;}
...
private:
float val;
}
class Seat{
public:
Parent* getPerson(){
return thePerson;
}
void setPerson(Parent *inPerson){
thePerson=inPerson;
}
...
private:
Parent* thePerson;
}
If i do this:
Child *c = new Child();
Seat *s = new Seat();
Child->setValue(12);
s->setPerson(c);
How would I make s->getPerson()->getValue() return 12, and not 0?
--Larry