arrow
arrow
arrow
In object-oriented programming, what is the method called where one type is defined based on another type?
Question



In object-oriented programming, what is the method called where one type is defined based on another type?

A.

Inheritance

B.

Class

C.

Object

D.

Polymorphism

E.

Encapsulation

Correct option is A

In Object-Oriented Programming, inheritance is the mechanism that allows one class (child/derived class) to be defined based on another class (parent/base class). It facilitates code reuse and establishes a hierarchical relationship between classes.

Here, the Dog class inherits the Animal class's properties and methods.
Important Key Points:
1. Inheritance allows a child class to use the properties and methods of its parent class.
2. It supports code reusability and reduces redundancy.
3. Syntax in C++: class DerivedClass : accessSpecifier BaseClass { };.
Knowledge Booster:
· Class: A blueprint for creating objects but does not inherently define one type in terms of another.
· Object: An instance of a class but unrelated to defining one type in terms of another.
· Polymorphism: Allows methods to behave differently based on the object it acts upon (e.g., method overriding or overloading).
· Encapsulation: Bundles data and methods together while restricting access to certain components.

Free Tests

Free
Must Attempt
Video Solutions

RBI Assistant Pre 2026 Full Mock Test -01

languageIcon English
  • pdpQsnIcon100 Questions
  • pdpsheetsIcon100 Marks
  • timerIcon60 Mins
languageIcon English
Free
Must Attempt
Video Solutions

RBI Asst Prelims 2026 : Reasoning Section Test 01

languageIcon English
  • pdpQsnIcon35 Questions
  • pdpsheetsIcon35 Marks
  • timerIcon20 Mins
languageIcon English
Free
Must Attempt
Video Solutions

RBI Office Attendant 2026 Full Mock Test - 01

languageIcon English
  • pdpQsnIcon120 Questions
  • pdpsheetsIcon120 Marks
  • timerIcon90 Mins
languageIcon English
test-prime-package

Access ‘IBPS SO IT Officer’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
354k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow