G
gccntn
I know the subject of the post is a bit cryptic, but here is what I'd
like my code to look like:
int main()
{
Car myCar;
myCar.Start();
myCar.acUnit.SwitchOn(); // invoke TurnOn(), method of class
AC, which is a member of class Car
myCar.acUnit.SetTemp(75); // invoking SetTemp(), method of class
AC, which is a member of class Car
...etc...
myCar.Stop();
return 0;
}
How should I declare classes Car and AC?
The way I see things, this is what the declarations would look like:
class AC
{
public:
SwitchOn();
SwitchOff();
SetTemp();
GetTemp();
private:
...etc...
}
class Car
{
public:
Start();
Stop();
...etc...
<access_specifier>:
AC acUnit;
Engine engine;
...etc...
}
What should <access_specifier> be so that I can invoke AC's methods
from a Car as outlined in the code above?
Thanks.
like my code to look like:
int main()
{
Car myCar;
myCar.Start();
myCar.acUnit.SwitchOn(); // invoke TurnOn(), method of class
AC, which is a member of class Car
myCar.acUnit.SetTemp(75); // invoking SetTemp(), method of class
AC, which is a member of class Car
...etc...
myCar.Stop();
return 0;
}
How should I declare classes Car and AC?
The way I see things, this is what the declarations would look like:
class AC
{
public:
SwitchOn();
SwitchOff();
SetTemp();
GetTemp();
private:
...etc...
}
class Car
{
public:
Start();
Stop();
...etc...
<access_specifier>:
AC acUnit;
Engine engine;
...etc...
}
What should <access_specifier> be so that I can invoke AC's methods
from a Car as outlined in the code above?
Thanks.