C++: Shortest and best way to "reinitialize"/clean a class instance
- by Oper
I will keep it short and just show you a code example:
class myClass
{
public:
myClass();
int a;
int b;
int c;
}
// In the myClass.cpp or whatever
myClass::myClass( )
{
a = 0;
b = 0;
c = 0;
}
Okay. If I know have an instance of myClass and set some random garbage to a, b and c.
What is the best way to reset them all to the state…