Consider the below program, in which line, error will be thrown?

class Base {
public :
int x, y;
public:
Base(int i, int j){
x = i;
y = j;
}
};
 
class Derived : public Base {
public:
Derived(int i, int j):x(i), y(j) {} // Line 1
void print() {
cout << x <<" "<< y; // Line 2
}
};
 
int main(void){
Derived d(10, 10); // Line 3
d.print();
return 0;
}

Line 1
Line 2
Line 3
No error, code will work fine
Verified Answer
Correct Option - a

To get all Infosys Certified CPP Programmer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram