Question: Each class must have there own .h or .cpp file! Thanks! 1st class: has one private attribute, color, which is a string, and another which
Each class must have there own .h or .cpp file! Thanks!


1st class: has one private attribute, color, which is a string, and another which is a pointer to an int. One constructor, with a string parameter with default value "Purple". The constructor will create a new int and assign it to the pointer variable, then give it value -13. The constructor displays message "Class created with color cce", replacing ccc with the color variable. Destructor, which displays message "class destroyed with color ccc and number nnn", replacing ccc with the color variable and nnn with the value the pointer points to, and deleting the pointer. Also create appropriate get and set methods for color. You'll have to write a copy constructor for the class as well as overloading operators. Have the copy constructor increase the value the new pointer points to by 1 (only the copy will increase, not the original) and display message "class created with color ccc and number nnn", replacing ccc with the color variable and nnn with the value the pointer points to. 2nd class: inherits public from 1st class. It has private attributes of length and width, both int. One constructor, with int parameters with default values of 3 and 5. The constructor displays message "Class created with color ccc, length 1ll, and width www", replacing ccc, 111, and www with the appropriate variable values. Destructor, which displays message "class destroyed with color ccc, length lll, and width www", replacing ccc, 111, and www with the appropriate variable values. Create appropriate get and set methods for the two attributes. Create a PrintMe method that prints "ccc object with 111 x www (area = aaa)" replacing ccc, 111, and www with the appropriate variable values and aaa with length multiplied by width. 3rd class: inherits public from 2nd class. It has private int attribute of height. One constructor, with an int parameter with default value of 2. The constructor displays message "Class created with color ccc, length in, width www, and height hhh", replacing ccc, in, www, and hhh with the appropriate variable values. Destructor, which displays message "class destroyed with color ccc, length 111, width www, and height hhh", replacing ccc, 111, www, and hhh with the appropriate variable values. Create appropriate get and set methods for the attribute. Create a PrintMe method that prints "ccc object with 111 x www x hhh (volume = ww)" replacing ccc, 111, www, and hhh with the appropriate variable values and www with length multiplied by width multiplied by height. Create a function called Test that accepts a parameter to the 3rd class. Inside the function, declare an instance of 3rd class and assign the parameter to it. Call the PrintMe method of both the parameter and local variable. Assignment: declare multiple instances of each object (1st class, 2nd class, and 3rd class), with and without initialization values (to show default parameter values work). Declare two more instances of 3rd class, called thing1 and thing2, using default values. Call PrintMe method of every object declared of type and class and 3rd class. Call Test, passing thing2 as parameter. Call PrintMe of thing1 and thing2. Put a breakpoint on the last '}' of your program so you can see final destructor messages. Capture a snippet of output and put it in your report along with all source code. Each class must have its cpp and .h files. own . widto Put a Go back to all classes and change private attributes to protected. What inheritance type should be used now in 2nd class and 3rd class? comment in your report as question 2A describing whether you need to change inheritance from public to something else. Modify your classes to directly access inherited attributes where possible. Re-run instructions listed in paragraph Assignment, above, using the new versions of your classes. 1st class: has one private attribute, color, which is a string, and another which is a pointer to an int. One constructor, with a string parameter with default value "Purple". The constructor will create a new int and assign it to the pointer variable, then give it value -13. The constructor displays message "Class created with color cce", replacing ccc with the color variable. Destructor, which displays message "class destroyed with color ccc and number nnn", replacing ccc with the color variable and nnn with the value the pointer points to, and deleting the pointer. Also create appropriate get and set methods for color. You'll have to write a copy constructor for the class as well as overloading operators. Have the copy constructor increase the value the new pointer points to by 1 (only the copy will increase, not the original) and display message "class created with color ccc and number nnn", replacing ccc with the color variable and nnn with the value the pointer points to. 2nd class: inherits public from 1st class. It has private attributes of length and width, both int. One constructor, with int parameters with default values of 3 and 5. The constructor displays message "Class created with color ccc, length 1ll, and width www", replacing ccc, 111, and www with the appropriate variable values. Destructor, which displays message "class destroyed with color ccc, length lll, and width www", replacing ccc, 111, and www with the appropriate variable values. Create appropriate get and set methods for the two attributes. Create a PrintMe method that prints "ccc object with 111 x www (area = aaa)" replacing ccc, 111, and www with the appropriate variable values and aaa with length multiplied by width. 3rd class: inherits public from 2nd class. It has private int attribute of height. One constructor, with an int parameter with default value of 2. The constructor displays message "Class created with color ccc, length in, width www, and height hhh", replacing ccc, in, www, and hhh with the appropriate variable values. Destructor, which displays message "class destroyed with color ccc, length 111, width www, and height hhh", replacing ccc, 111, www, and hhh with the appropriate variable values. Create appropriate get and set methods for the attribute. Create a PrintMe method that prints "ccc object with 111 x www x hhh (volume = ww)" replacing ccc, 111, www, and hhh with the appropriate variable values and www with length multiplied by width multiplied by height. Create a function called Test that accepts a parameter to the 3rd class. Inside the function, declare an instance of 3rd class and assign the parameter to it. Call the PrintMe method of both the parameter and local variable. Assignment: declare multiple instances of each object (1st class, 2nd class, and 3rd class), with and without initialization values (to show default parameter values work). Declare two more instances of 3rd class, called thing1 and thing2, using default values. Call PrintMe method of every object declared of type and class and 3rd class. Call Test, passing thing2 as parameter. Call PrintMe of thing1 and thing2. Put a breakpoint on the last '}' of your program so you can see final destructor messages. Capture a snippet of output and put it in your report along with all source code. Each class must have its cpp and .h files. own . widto Put a Go back to all classes and change private attributes to protected. What inheritance type should be used now in 2nd class and 3rd class? comment in your report as question 2A describing whether you need to change inheritance from public to something else. Modify your classes to directly access inherited attributes where possible. Re-run instructions listed in paragraph Assignment, above, using the new versions of your classes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
