#ifndef __EXAMPLE_H #define __EXAMPLE_H #include class Example { private: char *strPtr; // This pointer field causes us to be careful about copying... public: Example(const Example &other); // This is a "copy constructor". // It prevents compiler synthesis of a copy constructor. Example(const char *strVal); ~Example(); // this is the destructor // This is an overloaded assignment operator. // Notice it returns a reference. Example &operator=(const Example &other); // We overload the "+" operator to mean concatenation Example operator+(const Example &other) const; // Generally useful, but here for debug printing std::string toString() const; private: void _copyFrom(const Example &other); // private helper function private: // Artificial fields used so we can track copies unsigned int uid; static unsigned int globalUid; }; #endif // __EXAMPLE_H