Is it safe to call a function to intialize a class in a ctor list?
- by Michael Dorgan
I have Angle class that I want initialized to a random value. The Angle constructor can accept an int from a random() function. Is it safe to place this call in the ctor list:
foo::foo() : Angle(random(0xFFFF)) {...}
or do I have to do it in the body of the constructor?
foo::foo() { Angle = Angle(random(0xFFFF)); ...}
If it matters, the foo class is derived from another class and does have virtual methods. In addition, no exception handling is allowed in our app.