Your class is ALMOST perfect.
The only thing which is missing is the virtual destructor.
1 2 3 4 5 6 7 8 9 10 11
|
class Document
{
private:
string dNumber;
public:
Document(string dN);
string getDocumentNumber() const;
void virtual print() const;
inline virtual ~Document() {}
};
|
As it's inline, you don't need to add it to the Source file, it can simply stand in the header one.
There's no sign of overloading in your classes, in fact there's nothing to overload.
That's a simple derivation of a virtual class, overloading is a different concept.
EDIT:
All right, in fact as andywestken said (and coder777), you cannot call a constructor when you're initializing an array of data.
You need a default constructor for Memorandum.
@andywestken: He's using the Virtual keyword, there should be no problems with putting a virtual destructor in there.