I'm trying to write a smart pointer class for an int variable but I've gotten a little stuck. Firstly, to declare a smart pointer to an int, I MUST use this line of code (As seen in the main method below):
smart_pointer s = new int();
To do this, I try to overload the "=" operator and set a pointer to an int (called "value" in the smart_pointer class) to the address of this new int. However, I get this error for the first line of code in my main method:
"conversion from ‘int*’ to non-scalar type ‘smart_pointer’ requested"
What am I doing wrong? I thought "new int()" returned a memory address which I could set the smart_pointer's int pointer to by overloading the "=" sign...