How do I access a class from inside another class?
<p>The next part of the assignment tells me that the Class <code>RacingCar</code> contains four wheel objects as defined by class Wheel. Implement the wheels as an array of objects on the heap.</p>

<pre><code>class RacingCar{
    int speed;

public:
    void Accelerate(int value) {
        speed = speed + value;
    }

    void Brake(int value) {
        speed = speed - value;
    }

    void Turn(int value) {
        speed = value / 4;
    }

    void Print(){
        cout &lt;&lt; "The current KM/h of the car is: " &lt;&lt; speed;
    }
};

class Wheel {
    int *ptrSize;
    int pressure;

public:
    Wheel() : pressure(32) {
        ptrSize = new int(30);
    }

    Wheel (int s, int p) : pressure(p) {
        ptrSize = new int(s);
    }

    ~Wheel() {
        delete ptrSize;
    }

    void pump(int amount) {
        pressure += amount;
    }

    void print() {
        cout &lt;&lt; pressure;
    }
};

int _tmain(int argc, _TCHAR* argv[])
{
    Wheel *heapArray = new Wheel[4];
    RacingCar F1; //Creating a "Formula 1" test car

    //Test parameters
    F1.Accelerate(10);
    F1.Brake(50);
    F1.Turn(180);
    F1.Print(); //Checks to see if the car changes actually worked

    getch();

    delete [] heapArray; //Delete when you're done
    return 0;
}
</code></pre>

<p>Is it ideal to build a class like this, and then access it inside <code>RacingCar</code>? Or is there a better way to do so? I can't see a way to create it on the heap otherwise.</p>
