Thameera Senanayaka
Allion Technologies
Demo
class Box {
public:
Box(int width, int length, int height)
: m_width(width), m_length(length), m_height(height) // member init list
{}
int Volume() {return m_width * m_length * m_height; }
private:
int m_width;
int m_length;
int m_height;
};
Demo
My_Array first; // initialization by default constructor
My_Array second(first); // initialization by copy constructor
My_Array third = first; // Also initialization by copy constructor
second = third; // assignment by copy assignment operator
// Copy ctor
X(const X& other);
// Copy assignment operator
X& operator= (const X& other);
struct noncopyable
{
noncopyable() {};
private:
noncopyable(const noncopyable&);
noncopyable& operator=(const noncopyable&);
};
struct noncopyable
{
noncopyable() =default;
noncopyable(const noncopyable&) =delete;
noncopyable& operator=(const noncopyable&) =delete;
};
Demo