why functions in a class are defined outside the class using scope operator

Hi all,

code below
class A
{
int a;
public:
int func(int x); //why the definition is given outside the class
}
int A::func(int x)
{
a=10;
cout << a <<endl;
}
but i studied that if we define inside class its default becomes an inline function. but another thing is inline is a request to compiler.if function has more number of statements its treated as normal fucntion itself.so why are we defining outside the class.
why are we defining outside the class.
So we would not clutter the class by unneeded definitions. So we could separate implementation to another file making header lightweight
Topic archived. No new replies allowed.