Inheritance is shown by inheriting the student class into topper class. Which feature of oop is indicated by the following code? Here is the student1 class with a constructor which simply initializes the fields (instance variables) from its parameters.
Example of polymorphism in real life is a kid, who can be a student, a son, a brother. Which feature of oop is indicated by the following code? Encapsulation is indicated by use of classes inheritance is shown by inheriting the student class into topper class polymorphism is not shown here because we have defined the constructor in.
Inheritance polymorphism inheritance and polymorphism encapsulation and inheritance. For the feature given above, the oop feature used is polymorphism. Polymorphism is not shown here because we have defined the constructor in the topper class but that doesn’t mean that. Encapsulation is actually binding all the properties in a single class or we can say hiding all the features of object inside a class.
Class student { int marks; Polymorphism is not shown here because we have defined the constructor in the topper class but that doesn’t mean that. Inheritance is shown by inheriting the student class into topper class. Topper (int age) { this.age=age;
And abstraction is hiding unwanted data (for user) and. Often constructors do more work in initialization, including checking for.