lundi 3 août 2015

C++ : can I do some processing before calling another constructor?

I have a class with two constructors.

class Foo {
  Foo(B b) {... }

  Foo(int n) : Foo(buildBFromInt(n)) {} ??
}

The first takes some object and I would like to have a second one that first creates the object from a simpler type. Is this possible ?

Aucun commentaire:

Enregistrer un commentaire