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() const; // display all cow data } ; 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 string1.h to string2.h) by doing the following:
|
Get C++ Primer Plus, Fourth 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.