Constructor Functions  «Prev  Next»

Adding a constructor and initializers - Exercise

Objective: Add a constructor, an initializer list, and a destructor to the person class you created in an earlier exercise.

Instructions

The constructor and initializer list should have arguments for all the data members you created in your person class. You also might want to consider using the string library for any useful string functions you need.
Although we only discussed destructors briefly in this module, you should be able to add a very basic destructor to this class.

If you are having trouble creating a destructor, you may want to review the lessons entitled
  1. What is a destructor? and
  2. Constructor and destructor example.
Paste the source code of your class below and click the

Submit

button when you are ready to submit this exercise.