Question: This is a C++ question and development environment is Visual Studio 2015. The code below defines a class CAT that contains a private variable cName[80].
This is a C++ question and development environment is Visual Studio 2015.
The code below defines a class CAT that contains a private variable cName[80]. A function nameSwap() that swaps the name of two cats by using pointers is also defined. Design the nameSwap() function and the main() that will fulfill the following criteria. 1. Create and initialize cName[ ] of two CAT objects in the heap pointed by pA and pB as "Taby" and "Felix" respectively. 2. Show the initial name of the two cats created 3. Swap the name (i.e. string in cName[ ]) of the two cats using the pointer approach (Only swap the name, NOT the object) 4. Show the name again. #define _CRT_SECURE_NO_WARNINGS 1 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
