␡
- 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
Complete Program Output
Listing 10 shows the complete program output.
Listing 10 Program Output
Invoking 3-parameter constructor for AnyOldDocument Creating a Memo document for: Calling All Employees Invoking 4-parameter constructor for AnyOldDocument Creating an invoice document for: A Big Customer Invoice price value 3500 Now storing invoice in content management system Invoking 4-parameter constructor for AnyOldDocument Creating a contract document for: An Organization Contract penalty clause value 1000 Updated contract penalty clause value 50000 Now storing contract to archive Invoking the destructor for AnyOldDocument Invoking the destructor for AnyOldDocument Invoking the destructor for AnyOldDocument
The first half of Listing 10 shows the instantiation of objects and initialization code. I also update the invoice price and contract penalty clause values. I then archive the documents prior to deleting them.