␡
- The Takeaway
- Document Management
- The Base Class: AnyOldDocument
- Economy in Coding
- The First Document Type: A Memo
- The Second Document Typean Invoice
- The Third and Last Document Typea Contract
- Leveraging Base Class Generality
- Polymorphism
- Complete Program Output
- Make Your Destructors Virtual
- Conclusion
- Additional Reading
Like this article? We recommend
Economy in Coding
I want to use inheritance as a means for minimizing the code in derived classes. So, I’ve placed the four data members documentId, documentName, documentType, and associatedNumber in the base class. The values of these variables change depending on the instantiated objects of the derived classes, but they are common across the range of derived classes that we’ll be looking at. Let’s now create some objects derived from the base class.