Quote Originally Posted by jefftee View Post
That said, there are two common ways of initializing class member variables, using 1) The constructor initializer list or; 2) by assigning values in your constructor.
There is also a third one which the OP has actually used -- by initializing at the time the variable is declared:

Qt Code:
  1. // Example.h
  2. class Example
  3. {
  4. public:
  5. Example();
  6. ~Example();
  7. private:
  8. int a = 1; // <==
  9. int b = 2; // <==
  10. }
To copy to clipboard, switch view to plain text mode