Question

A nice example of an oops may be found here....


A nice example of an oops may be found here.

Answer

Object-oriented programming (OOP):

is a programming paradigm in which code is written in a certain fashion.

In the oops, every real-world item is considered an object, and the definition for that object must be provided using a class.

The oops is related with numerous notions, some of which are quite significant.

The following are key oops concepts:

Class.

Object.
Abstraction or data concealment
Inheritance.
Polymorphism.

Class:

A class serves as a blueprint for an object, defining all of the characteristics and operations of that object.

It basically represents all of the object's characteristics.


If there is an object named a student (a real-world entity), the class will specify all of the characteristics and methods associated with that student ( functions of the student ).


The student's attribute = name, age, etc.


Reading(), writing(), and other student functions

Object:

In oops programming, an object is a real-world item, which implies that anything with certain qualities may be considered an object, and the programmer must define the object.

After giving the object a definition (using class), it may be utilized in a variety of ways, including problem solving.

Student, animal, bank account, and so forth are examples of objects.

Abstraction:

Abstraction is a quality that allows a user to view just the key functionality of a system, implying that the major purpose of this notion is to conceal the system's underlying complexity from the user and only expose the necessary information needed for the user to utilize it effectively.

For example, there is an object car that has all of its characteristics and methods specified, but the user just wants to perceive this car object as a vehicle and not as a collection of numerous features and functions so that it can utilize it quickly.

The programmer should concentrate on the object's characteristics and methods rather than the user.

Inheritance:

In the oops idea, inheritance is a crucial concept.

The inheritance idea is utilized to establish an object's is-a connection.

There are two items in this example: one is a student and the other is an undergraduate student.

Now, the student object has all of the student's general attributes, but the undergraduate student object also contains the undergraduate student's properties, therefore there is an is-a link between the two things. Undergraduate student is a student, which means it inherits all of the normal characteristics of a student as well as certain unique characteristics specific to undergraduate students.
Student attributes may be utilized in undergraduate objects as well, and the programmer will not have to develop code for generic properties.

Recent Questions