c++ - Simplest way to initialize multiple related const properties in a constructor? -
When the many cost properties of a C ++ class depend on some intermediate calculations, the simplest way to get them started What is it?
For example, how can I correct the constructor for the class given below?
class MyClass {public: const int a; Const int b; MyClass () {int relatedVariable = rand ()% 250; A = related wearable% 100; B = ABS (related weenble - 150); }};
With C ++, you can simply use a delegate:
class MyClass {public: const int a; Const int b; Private: Michelle (Intimate related Weaponal): One (related variable% 100), B (ABS (related weenable - 150)) Public: MylCass (): MylCass (rand (%) 250} {}};
Comments
Post a Comment