Which feature of OOP is indicated by the following code? class student{int marks;};
Which feature of OOP is indicated by the following code?
class student{int marks;};
class topper: public student{int age;
topper(int age) {this.age=age;}};
Show answerHide answer
Correct answer: (A) Encapsulation and inheritance
Explanation
Data hidden inside the classes shows encapsulation, and topper deriving from student with public shows inheritance. There is no overloading or overriding, so polymorphism is not shown.