mirror of
https://github.com/github/codeql.git
synced 2026-02-15 14:33:40 +01:00
27 lines
518 B
C++
27 lines
518 B
C++
class C {
|
|
private:
|
|
Other* other = NULL;
|
|
public:
|
|
C(const C& copyFrom) {
|
|
Other* newOther = new Other();
|
|
*newOther = copyFrom.other;
|
|
this->other = newOther;
|
|
}
|
|
|
|
//No operator=, by default will just copy the pointer other, will not create a new object
|
|
};
|
|
|
|
class D {
|
|
Other* other = NULL;
|
|
public:
|
|
D& operator=(D& rhs) {
|
|
Other* newOther = new Other();
|
|
*newOther = rhs.other;
|
|
this->other = newOther;
|
|
return *this;
|
|
}
|
|
|
|
//No copy constructor, will just copy the pointer other and not create a new object
|
|
};
|
|
|