Kategorier: Alle - variables - methods - classes - objects

av felipe ramirez 3 år siden

449

What is object-oriented programming ?

Object-oriented programming (OOP) revolves around the concept of "objects," which encapsulate data and code. This programming paradigm uses inheritance to promote code reuse and extensibility, generally through classes or prototypes.

What is object-oriented programming ?

What is object-oriented programming ?

Languages that support object-oriented programming (OOP) often use inheritance for reuse and extensibility of code in the form of classes or prototypes. Those who use classes support two main concepts

Objects sometimes correspond to things found in the real world. For example, a graphics program can have objects like "circle", "square", "menu". An online shopping system can have objects such as "shopping cart", "customer" and "product".
part

Class methods: they belong to the class as a whole and have access only to the class variables and the inputs of the procedure call

Instance methods: They belong to individual objects and have access to the instance variables for the specific object being called, the inputs, and the class variables.

Member variables: Refers to both the class and the instance variables defined by a particular class.

Instance variables or attributes: data that belongs to individual objects; each object has its own copy of each

Class variables: they belong to the class as a whole; there is only one copy of each

Classes: the data format definitions and procedures available for a given type or class of object; they can also contain data and procedures themselves

In OOP, computer programs are designed by making them from objects that interact with each other

If a class does not allow the calling code to access the internal data of the object and allows access only through methods, this is a strong form of abstraction or hiding of information known as encapsulation
Encapsulation is an object-oriented programming concept that ties together data and the functions that manipulate the data, and keeps it safe from external interference and misuse. Data encapsulation led to the important OOP concept of data cloaking.

A characteristic of objects is that an object's own procedures can access and often modify the data fields of itself

This allows classes to be organized into a hierarchy representing "is a type of" relationships.
Languages that support classes almost always support inheritance.
For example, the Employee class can inherit from the Person class. All data and methods available to the parent class also appear in the child class with the same names

is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields

Many of the most widely used programming languages are multi-paradigm and object-oriented programming support, to a greater or lesser degree, usually in combination with imperative, procedural programming.