Jim Langston wrote:[color=blue]
> "Jim Langston" <tazmaster@rocketmail.com> wrote in message
> news:XhExe.11435$Si3.2946@fe06.lga...[color=green]
>> "Josh Mcfarlane" <darsant@gmail.com> wrote in message
>> news:1120341854.863166.216020@f14g2000cwb.googlegr oups.com...[color=darkred]
>>> Ok, this may be a simple question.
>>>
>>> I have a base class, CDatabase. This class contains pointers to other
>>> classes containing data from raw files. Due to the way our system is
>>> set up, the format of these raw files has changed so I need multiple
>>> ways to read them. The old programmer had massive amounts of switch
>>> statements depending on the version, I want to simplify this.
>>>
>>> If I have the following in CDatabase:
>>> CRuttingData * pRuttingData;
>>>
>>> can I then assign pRuttingData to any inheritted members of
>>> CRuttingData?[/color]
>> Yes.
>>[color=darkred]
>>> For example, if I wanted to read V2 data, could I use:
>>> pRuttingData = new CRuttingDataV2;[/color]
>> Yes, as long as CRuttingDataV2 is derived from CRuttingData[/color]
>
> Actually, I think you have to do pRuttingData = (CRuttingData*) new
> CRuttingDataV2.[/color]
NO! Not only is it not necessary, it would be wrong.
HTH,
--ag
[The rest of your argument, however, is spot on. ;-)]
--
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays