Can a class be used as a pointer?
<p>in one of my assignments i was asked to create a lamp in c++ that contains bulbs and able to switch the bulbs at will. CLamp has an instant of CBulb inside of it. This is part of the solution for the lab:</p>

<p>in the CLamp class:</p>

<pre><code>CLamp::CLamp(const CLamp&amp; oldLamp)
{
    bptr  = new CBulb;
    *bptr = *(oldLamp.bptr);
}
</code></pre>

<p>and:</p>

<pre><code>CBulb *CLamp::ExchangeBulb(CBulb *theNewBulb)
{
    CBulb *tmp = bptr;
    bptr = theNewBulb;

    return tmp;
}
</code></pre>

<p>in the main:</p>

<pre><code>CLamp lamp1(*some number*);
CBulb *testbptr = new CBulb(*some other number*);
CBulb *temp = lamp1.ExchangeBulb(testbptr);
delete temp;
</code></pre>

<p>so what does <code>CBulb *CLamp::ExchangeBulb(CBulb *theNewBulb)</code> mean? What is <code>ExchangeBulb</code> a member function of? also does this mean that <code>*Clamp</code> is an object of type <code>CBulb</code>? thanks in advance for you time. </p>
