Starting from:

$29.99

Lab 5 CSE 165

Lab 5
CSE 165
All the exercises below are selected from the textbook: Thinking in C++ (volume 1).
1. [Exercise 1 on Page 610] Create a class Counted that contains an int id and a static int count. The default
constructor should begin: Counted() : id(count++). It should also print its id and that it’s being created. The destructor
should print that it’s being destroyed and its id. Test your class. [35 pts]
2. [Exercise 4 on Page 610] Create a vector< Counted*> and fill it with pointers to new Counted objects (from Exercise
1). Move through the vector and print the Counted objects, then move through again and delete each one. [30 pts]
2. [Exercise-14 on Page 718] In AddingVirtuals.cpp, make all the member functions of Pet pure virtual, but provide a
definition for name(). Fix Dog as necessary, using the base-class definition of name(). [35 points]
Requirements:
* Usage of spaces, blank lines, indention, and comments for readability.
* Descriptive names of variables, functions, structs, classes, and objects (if any).
* Appropriate usage of structs, classes, and objects (if any).
Penalties:
* Zero if you have possession of a copy of online solutions or work done by someone else.
* 5-point deduction per day late

More products