Skip to main content
2 of 5
Copy edited. Expansion.
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

I believe you can call a constructor from a constructor. It will compile and run. I recently saw someone do this and it ran on Windows and Linux.

It just doesn't to what you want. The inner constructor will construct a temporary local object which gets deleted once the outer constructor returns. They would have to be different constructors as well or you would create a recursive call.

Ref: http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.3

sqqqrly
  • 893
  • 1
  • 7
  • 10