Question: c + + 6 . 1 2 . 3 : Creating a constructor with a constructor initializer list. Complete the PoundDog code by adding a

c++6.12.3: Creating a constructor with a constructor initializer list.
Complete the PoundDog code by adding a constructor having a constructor initializer list that initializes age with 1, id with -1, and name with "NoName". Notice that MyString's default constructor does not get called.
Note: If you instead create a traditional default constructor as below, MyString's default constructor will be called, which prints output and thus causes this activity's test to fail. Try it!
// A wrong solution to this activity... PoundDog::PoundDog(){ age =1; id =-1; name.SetString("NoName");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!