Skip to content

Instantly share code, notes, and snippets.

@fortheday
Last active January 30, 2018 08:52
Show Gist options
  • Save fortheday/4ba65b2cd25f84e6345302b1ad0c1a34 to your computer and use it in GitHub Desktop.
Save fortheday/4ba65b2cd25f84e6345302b1ad0c1a34 to your computer and use it in GitHub Desktop.
class CCaseA {
public:
CCaseA() = delete;
};
class CCaseB {
public:
CCaseB() = default;
CCaseB & operator =(const CCaseB &) = delete;
};
class CCaseC {
private:
char *m_pBuffer;
public:
CCaseC() : m_pBuffer(new char[10]) { }
};
class CCaseC_Derived : public CCaseC {
public:
using CCaseC::CCaseC;
};
void ConstructorTest()
{
CCaseA caseA; // COMPILE ERROR
CCaseB caseB;
CCaseC caseC;
CCaseC_Derived caseCD;
caseC = caseC; // shallow copy
caseB = caseB; // COMPILE ERROR
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment