Object, Class, and Inheritance are the main characteristics of Object-Oriented programs. Here is the definition of object, class, and inheritance...
Object
The object is a concept with defined boundaries that are the same as the problem we are working with. Its main purpose is to understand the real world and to provide a practical basis for a computer application. When we approach a programming problem in an object-oriented language, the problem is divided into different objects. An object includes data and functions, functions are used to perform the operations on data. The data containing the object is called member data and the function is a member function. It provides data security. The basic concept of object-oriented programming is to combine into a single unit, both the data and its functions. An object is an instance of a class. It can be uniquely identified by its name and it defines a state which is represented by the values of its attributes at a particular time or is an individual unit of run-time data storage. Every object is capable of receiving messages, data and sending messages to other objects.
Class
A class is a collection or group of similar objects that have the same properties, common behavior, and relationships. Objects with similar properties and actions need to be grouped together into a unit that can be used in a program. Each class describes a set of individual objects. The concept of class leads to the reusability of programming code. A code is written in an object of the class that can be reused by another object of the class. This concept helps to decrease the length of programming code. A class describes a collection of encapsulated instance variables and methods, possibly with the implementation of those types together with a constructor function that can be used to create objects of the class.
Inheritance
Inheritance is the property that allows the reuse of an existing class to build a new class. The principle in this sort of division is that each subclass shares the same properties with the class from which it is derived. For example, all vehicles in a class may share the properties of having wheels and a motor. Inheritance is a way to form new classes. The new classes are known as derived classes. Base classes are referred to help reuse existing code with little reduction. There are four types of Inheritance. They are:
- Single Inheritance
- Multiple Inheritance
- Hierarchy Inheritance
- Multilevel Inheritance
These are the three characteristics of OOP which are Object, Class, and Inheritance.
Previous Post: WHAT IS A JOURNAL AND LEDGER?
Comments
Post a Comment