0

Can i call a constructor within a member function ?Is it an example of constructor chaining? Is constructor chaining valid in the latest C++ version?(like what we have in C#)

Hossein
  • 24,202
  • 35
  • 119
  • 224
  • possible duplicate http://stackoverflow.com/questions/7349183/constructor-chaining-in-c – minus Aug 23 '12 at 18:24
  • You can call constructors and desctructors directly, but I would be careful with that. Are you trying to achieve something like: http://stackoverflow.com/questions/2494471/c-is-it-possible-to-call-a-constructor-directly-without-new ? – Marcus Riemer Aug 23 '12 at 18:26
  • @MarcusRiemer:No,I read that constructor chaining was invalid in c++ i just wanted to know if it is supported lately or not, and i also wanted to know if i could call a constructor from a member function or not.The link minus posted has the most simarilty to my question (actually my question was raised because of the same article, app asked about.) – Hossein Aug 23 '12 at 18:35

1 Answers1

5

1) Yes

2) No, calling a constructor from a function is not constructor chaining.

3) Yes, it is called Delegating Constructors

Chris Dargis
  • 5,891
  • 4
  • 39
  • 63