consider the code given below:
class base { //line1
private: //line2
const int a; //line3
public: //line4
base(int val = 0) : a(val) {} //line5
int get_a() { return a; }
}; // C4512 warning
class base2 {
private:
const int a;
public:
base2(int val = 0) : a(val) {}
base2 & operator=( const base2 & ) {}
int get_a() { return a; }
};
int main() {
base first;
base second;
// OK
base2 first2;
base2 second2;
}
What does the 'line5' signify?..I think ':' operator is for deriving a class from base class. But what is it doing for a method? I really could not understand .Can anyone help me???
class base { //line1
private: //line2
const int a; //line3
public: //line4
base(int val = 0) : a(val) {} //line5
int get_a() { return a; }
}; // C4512 warning
class base2 {
private:
const int a;
public:
base2(int val = 0) : a(val) {}
base2 & operator=( const base2 & ) {}
int get_a() { return a; }
};
int main() {
base first;
base second;
// OK
base2 first2;
base2 second2;
}
What does the 'line5' signify?..I think ':' operator is for deriving a class from base class. But what is it doing for a method? I really could not understand .Can anyone help me???
Comment