GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — codeql/cpp/ql/src/Best Practices/RuleOfTwo.cpp at codeql-cli/v2.10.5 · github/codeql Expand file tree/ Copy pathRuleOfTwo.cppMore file actions 26 lines (22 loc) · 518 Bytes / Copy pathRuleOfTwo.cppFile metadata and controls26 lines (22 loc) · 518 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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 }; |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |