first declare the function inside the class
Code:
class myclass
{
int foo();
};
next, write the implementation code in a *.cpp file
Code:
int myclass::foo()
{
cout << "this is function foo" << endl;
return 0;
}
If the function is short enough, you can combine the above two (called inline code)
Code:
class myclass
{
int foo()
{
cout << "this is function foo" << endl;
return 0;
}
};
>>I don't care if you guys need this info or not I'm going to provide it anyway
Yes, please always provide that info when you make an initial post to avoid any possibiliity of confusion. The answer to some questions depend on it.