class name
{
public:
int var1;
void calc(void);
name();
~name();
};
name object;
void function1(void);
void function2(void);
int main(void)
{
name object;
cout << "MAIN: var1 is 25" << endl;
cout << object.var1 << endl;
object.calc();
cout << "var1 - 10" << endl;
cout << object.var1 << endl;
function1();
function2();
return 0;
}
void function1(void)
{
name object;
cout << endl << "function1: var1 is 25 again" << endl;
cout << object.var1 << endl;
object.calc();
cout << "var1 - 10" << endl;
cout << object.var1 << endl;
}
void function2(void)
{
name object;
cout << endl << "function2: var1 is 25 again" << endl;
cout << object.var1 << endl;
object.calc();
cout << "var1 - 10" << endl;
cout << object.var1 << endl;
}
void name::calc(void)
{
var1 -= 10;
}
name::name()
{
var1 = 25;
}
name::~name()
{
}