+ 1
Why does the compiler revive a deleted object?
I'm trying to create a program where it makes sure that there is only one instance of the "Clock" class. The constructor of the "unwanted" object will call the destructor method. Basically an object suicide. But it didn't work out. Why? https://code.sololearn.com/cg6CKSgoqoTE/?ref=app
3 Respostas
+ 2
Are you making a singleton?
https://www.sololearn.com/learn/713/?ref=app
+ 2
There are two problems:
1.Clock::getInstance() returns Clock* but bob is a Clock so add an star before bob.
2.bob will be a Clock* and dot operator should replace with arrow(->)
0
GHOST mHBr thanks