Programming Exercises
1: | Consider the following class declaration:
class Cow { char name[20]; char * hobby; double weight; public: Cow(); Cow(const char * nm, const char * ho, double wt); Cow(const Cow c&); ~Cow(); Cow & operator=(const Cow & c); void ShowCow(); // display name, hobby, and weight of a cow }; Provide the implementation for this class and write a short program that uses all the member functions. |
2: | Enhance the String class declaration (that is, upgrade strng2.h to string3.h) by doing the following:
|
Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.