I have recently discovered that when I have pointers within a class, I need to specify a Copy constructor.
To learn that, I have made the following simple code. It c
When writing a Copy Constructor, you should allocate memory for all members. In your case:
TRY::TRY(TRY const & copyTRY){
pointer = new int(*(copyTry.pointer));
}
Operator= is somehow similar, but with no memory allocation.
TRY& operator=(TRY const& otherTRY){
this->a = *(otherTry.pointer)
return *this
}