Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Identify a two (2) real-world objects related by inheritance such as vehicle-car, building-house, computer-macbook, person-student. Then, design both classes which represent each category of

image text in transcribed
image text in transcribed
Instructions Identify a two (2) real-world objects related by inheritance such as vehicle-car, building-house, computer-macbook, person-student. Then, design both classes which represent each category of those objects. Finally, implement it in C++. Class requirements The name of the classes must be related to the category of the object such as car, vehicle, building, house, etc. The base class must contain at least 2 attributes (member variables). These must be private. The derived class must contain at least 2 additional attributes (member variables). These must be private. Each attribute must have at least one accessor and one mutator. These must be public. Accessors must have the const access modifier. The accessors and mutators inherited to the derived classes may be overridden if needed. In each class, at least one mutator must have a business rule which limits the values stored in the attribute. Examples: a) The attribute can only store positive numbers. b) The attribute can only store a set of values such as "True", "False", "NA". c) The maximum value for the attribute is 100. Each class must have at least 2 constructors. At least one of the derived class' constructors must call one of the base class' constructors. Each class must have one destructor. The destructor will display "An X object has been removed from memory." where X is the name of the class. Additional private and public member functions can be implemented if needed in the class. Implementation Create h and cpp files to implement the design of each class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions