Question:

Which of the following programming language uses objects, classes, inheritance, and polymorphism?

Show Hint

Four pillars of Object-Oriented Programming:
• Encapsulation
• Abstraction
• Inheritance
• Polymorphism Among the given options, C++ is the language that supports all these OOP features.
  • BASIC
  • C++
  • FORTRAN
  • COBOL
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Concept: Object-Oriented Programming (OOP) is a programming paradigm that organizes software around objects rather than functions. An object represents a real-world entity that contains:
• Data (Attributes)
• Functions (Methods) The four fundamental features of Object-Oriented Programming are:
• Classes
• Objects
• Inheritance
• Polymorphism Languages supporting these concepts are known as Object-Oriented Programming Languages.

Step 1:
Understand the concept of a Class.
A class acts as a blueprint for creating objects. For example: \[ \text{Class } = \text{Student} \] Objects created from this class may represent individual students.

Step 2:
Understand Inheritance.
Inheritance allows one class to acquire the properties and methods of another class. This promotes:
• Code reusability
• Reduced development effort
• Better software organization

Step 3:
Understand Polymorphism.
Polymorphism allows the same function name or interface to perform different tasks depending on the context. It is one of the most powerful features of object-oriented programming.

Step 4:
Analyze the given options.

• BASIC – Primarily procedural.
• FORTRAN – Mainly used for scientific computation.
• COBOL – Designed for business applications.
• C++ – Fully supports classes, objects, inheritance, encapsulation, and polymorphism.

Step 5:
Identify the correct language.
Since C++ provides all major object-oriented programming features, it satisfies the requirements stated in the question. \[ \boxed{\text{C++}} \] Therefore, the correct answer is option (B).
Was this answer helpful?
0
0