|
-
March 1st, 2002, 01:20 PM
#1
base class ptrs as data members
Hello All,
I have a class that has a data member which is an array of pointers to derived class instances.
ex.
class COwner
{
public:
CProperty *array[28];
int num_props;
public:
COwner();
~COwner();
SetProp(int num_props);
virtual bool buyProperty(CProperty* const) = 0;
virtual CProperty* sellProperty(const CPoint&) = 0;
const CProperty* operator[](int n) const;
};
CProperty is a base class, the derived classes are CHouses, CApartments, CBeachfronts.
Question: (hope this isn't too trivial)
1. do I assign the array of pointers to the derived instances in the constructor of "COwner" class?
I am using MFC application. there is no main!
any help is appreciated.
thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|