Is it possible to define function or method outside class declaration? Such as:
class A
{
int foo;
A (): foo (10) {}
}
int A::bar ()
{
return foo;
}
It is possible to define but not declare a method outside of the class, similar to how you can prototype functions in C then define them later, ie:
class A
{
int foo;
A (): foo (10) {}
int bar();
}
// inline only used if function is defined in header
inline int A::bar () { return foo; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With