Questions tagged [rule-of-three]

The rule of three (also known as the Law of The Big Three or The Big Three) is a rule of thumb in C++ that claims that if a class defines one of the following it should probably explicitly define all three: destructor, copy constructor, assignment operator

65 questions
-1
votes
1 answer

Move assignment operator, move constructor

I've been trying to nail down the rule of 5, but most of the information online is vastly over-complicated, and the example codes differ. Even my textbook doesn't cover this topic very well. On move semantics: Templates, rvalues and lvalues aside,…
-1
votes
1 answer

Rule of Three. Copy Constructor, Assignment Operator Implementation

Rule of Three. Copy Constructor, Assignment Operator Implementation #include using namespace std; class IntPart { public: IntPart(); // default constructor IntPart(int n); private: unsigned int* Counts; unsigned int numParts; …
-2
votes
1 answer

Linked List copy constructor crashing program

i am unsure as to why my copy constructor seems to be crashing the program, all the other functions have been fine in the linked list class. The rule of 5 is really confusing me now with implementation. If anyone has some pointers or guidance of…
-3
votes
2 answers

C++ Error with big three leak in memory-pointer being freed was not allocated (not duplicate)

My code does not run correctly and I don't know how to fix it. This is not a duplicate question to someone asking what is the rule of three because that post does not help me in solving my question as in this post im using a pointer pointer array. I…
Brogrammer
  • 191
  • 1
  • 1
  • 10
-4
votes
2 answers

rule of three exercise unexpected result

I try to learn C++ basis in my free time and follow exercises of a book. Firstly, when I enter 9 as row and 8 as column I get malloc freeing error. Secondly, I get 0 as output I can't see what I enter. I want to write the program because I can…
1 2 3 4
5