I was wondering either it is possible in c++ to run a constructor overload within another constructor. I know it is possible using regular methods. What I am tryng to do:
class Foo
{
public:
Foo();
Foo(int val);
};
Foo::Foo()
{
Foo(1);
}
Foo:Foo(int val)
{
std::cout << val;
}
This doesnt compile for me. I am trying to create 2 constructors one witch takes parameter and one that sets it as default (the void one). I would aprichiate all help.