Illustrates all of the basic parts of a class, e.g., Constructors, operators, destructor, and member data.
ClassAnatomy.h
#include <string>
class Test
{
public:
Test(); // void constructor, sometimes called default constructor
Test(const std::string& name); // constructor for named instance
Test(const Test& t); // copy constructor
Test(Test&& t); // move constructor
Test& operator=(const Test& t); // copy assignment operator
Test& operator=(Test&& t); // move assignment operator
virtual ~Test(); // destructor
std::string& name();
void say();
private:
std::string name_;
};