Starting from:
$30

$24

Homework 5 Solution

The goal is this homework is get you familiar with constructors, destructors, default constructors, copy constructors, assignment operators, and the calling sequences of constructors and destructors.




This homework is based upon the three classes of Shape, Square, and Circle that you designed in Homework 4.




You need to add two constructors to each class: a constructor with parameters and a default constructor that has no parameters. In each of the 6 constructors, you need to use cout to print out something to indicate that this constructor is called.



You need to add the destructor to each class. In each destructor, you need to use cout to print out something to indicate that this destructor is called.



You need to add a copy constructor to each class. In each copy constructor, you need to use cout to print out something to indicate that this copy constructor is called.



You need to add an assignment operator to each class. In each assignment operator, you need to use cout to print out something to indicate that this assignment operator is called.



In your main function, you should have the code to instantiate a square object as a variable, and you should also have the code to instantiate a square object using new.



In your main function, you should have the code to instantiate a circle object as a variable, and you should also have the code to instantiate a circle object using new.
In your main function, you should have the code to delete the square object and the circle object that you instantiated using new. Your code should have no memory leaks.



In your main function, you need to put the code that you instantiate a square object as a variable inside of a block {} within the main function.



For each cout statement, you should use endl to make sure that each print is on a separate line.



Copy paste the output of your program into a word file, and for each line of output, you need to explain why your program outputs that line.









Due: January 28th, 11:59PM, 2019.










Turn in one file via handin: the zip file of (1) your whole NetBean directory and (2) the Word




file. The name of your file should be: LastName_FirstName. For example, if your name is John




Smith, you should turn in two files: Smith_John.zip.

More products