I have this constructor which give an error on compilation :-
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); {};
here is full error:-
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); {};
^
As a noob I have no idea what is going on. On googling ,I only find one stackoverflow link which also doesn't help.