Well, I dont if I'm correct. I was asked the same question by my friend, How to call display a string before main() and another string after main()...
Something like
int main()
{
cout<<"Love";
}
int main()
{
cout<<"Love";
}
To copy to clipboard, switch view to plain text mode
Now without touching main() I need to display "I Love You"
So the solution is something like this
class A
{
public:
A(){ cout<< "I"; }
~A() { cout<<"You"; }
};
A a;
int main()
{
cout<<"Love";
}
class A
{
public:
A(){ cout<< "I"; }
~A() { cout<<"You"; }
};
A a;
int main()
{
cout<<"Love";
}
To copy to clipboard, switch view to plain text mode
Here 'I' is displayed before main and 'You' after main.. Do you want something like this???
//I have not tested above code so might be incorrect....
Bookmarks