Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. class MyClass {
  2. public:
  3.   MyClass(int i=0) : second(i), first(second) {}
  4.   int first;
  5.   int second;
  6. };
  7.  
  8. int main() {
  9.   MyClass myclass;
  10.   std::cout << myclass.first << ":" << myclass.second << std::endl;
  11.   return 0;
  12. }
  13.  
  14.         <error id="initializerList" severity="style" msg="Member variable &apos;MyClass::first&apos; is in the wrong place in the initializer list." verbose="Member variable &apos;MyClass::first&apos; is in the wrong place in the initializer list. Members are initialized in the order they are declared, not in the order they are in the initializer list.  Keeping the initializer list in the same order that the members were declared prevents order dependent initialization errors." inconclusive="true">
  15.             <location file="a.cpp" line="37"/>
  16.             <location file="a.cpp" line="36"/>
  17.         </error>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement