J
Josh Mcfarlane
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?
For example, if I wanted to read V2 data, could I use:
pRuttingData = new CRuttingDataV2;
If this method works, I can then only have to deal with data reading on
the inheritted class level and in the initialization of CDatabase vs in
every function.
Thanks,
Josh McFarlane
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?
For example, if I wanted to read V2 data, could I use:
pRuttingData = new CRuttingDataV2;
If this method works, I can then only have to deal with data reading on
the inheritted class level and in the initialization of CDatabase vs in
every function.
Thanks,
Josh McFarlane