Is it possible to define function or method outside class declaration? Such as:
class A { int foo; A (): foo (10) {} } int A::bar () { return
Yes, but you have to declare it first in the class, then you can define it elsewhere (typically the source file):
// Header file class A { int foo = 10; int bar(); // Declaration of bar }; // Source file int A::bar() // Definition of bar { return foo; }