나는 컴파일에 오류를 줄이 생성자가 : -오류 : 시대 착오적 이전 스타일의 기본 클래스 이니셜 라이저 [-fpermissive]
여기Time::Time(short y,short m,short d,short h,short mi,short s):
(*this).y(y);
(*this).m(m);
(*this).d(d);
(*this).h(h);
(*this).mi(mi);
(*this).s(s); {};
가 전체 오류입니다 : - A와
Time.cpp: In constructor ‘Time::Time(short int, short int, short int, short int, short int, short int)’:
Time.cpp:22:2: error: anachronistic old-style base class initializer [-fpermissive]
(*this).y(y);
^
Time.cpp:21:61: error: unnamed initializer for ‘Time’, which has no base classes
Time::Time(short y,short m,short d,short h,short mi,short s):
^
Time.cpp:22:9: error: expected ‘{’ before ‘.’ token
(*this).y(y);
^
Time.cpp: At global scope:
Time.cpp:22:9: error: expected unqualified-id before ‘.’ token
Time.cpp:23:4: error: expected unqualified-id before ‘this’
(*this).m(m);
^~~~
Time.cpp:23:4: error: expected ‘)’ before ‘this’
Time.cpp:24:4: error: expected unqualified-id before ‘this’
(*this).d(d);
^~~~
Time.cpp:24:4: error: expected ‘)’ before ‘this’
Time.cpp:25:4: error: expected unqualified-id before ‘this’
(*this).h(h);
^~~~
Time.cpp:25:4: error: expected ‘)’ before ‘this’
Time.cpp:26:4: error: expected unqualified-id before ‘this’
(*this).mi(mi);
^~~~
Time.cpp:26:4: error: expected ‘)’ before ‘this’
Time.cpp:27:4: error: expected unqualified-id before ‘this’
(*this).s(s); {};
^~~~
Time.cpp:27:4: error: expected ‘)’ before ‘this’
Time.cpp:27:17: error: expected unqualified-id before ‘{’ token
(*this).s(s); {};
^
을 noob 나는 무슨 일이 벌어지고 있는지 전혀 모른다. 인터넷 검색, 난 단지 도움이되지 않는 한 stackoverflow 링크를 찾을 수 있습니다.
'(* this).'을 모두 삭제하십시오. –
또한 모든 세미콜론을 일반 쉼표로 바꾸십시오 – UnholySheep
비슷한 질문 https://stackoverflow.com/questions/29422285/error-anachronistic-old-style-base- 클래스 이니셜 라이저 – user2807083