Why is object-oriented programming preferred in most projects? OOP offers an effective way to combat their complexity. Instead of considering the program as a sequence of executable instructions, it presents it as a group of objects with certain properties and performs certain actions with them. This leads to clearer, more reliable and easy to maintain applications.
- () , . – , . , , .
C, Pascal, FORTRAN . - : , , , . . , ( ) . , .
, . , . . .
, .
, , : , .
– , .
, . . . . . , , .
. , , .
, ? -, . -, .
, . , , . .
, , , C, . .
, . , , . .
. , .
. -, . -, . , .
, - , 5 , 12. short long. .
, , . , . , .
, . , . , . .
( ) , - . , . , ( ) ( ).
– , - . , "" "". , . . : , -, . , .
. , - C ++, . . . – -.
, , . . , .
, , , , -.
(- ) – C++ (-). Java , , , , C++. C# C++.
, - C++ -, Smalltalk. . .
. , , . . : , , . . . , , . . , , . , , . . .
, . C++ , . , - C++ . , -.
:
- . - . .
? .
– :
:
:
:
: . .
– . ? . int, . . , C++. int.
. , , , int .
– . , . , , . – .
. , , , , . .
, , . . . . , .
, , . , . , . , , . , . - .
, . , .
. , , . – . , .
. , (, ), :
position1 = position + origin,
position1, position origin – . , , .
,
= () + (), , , , int. position . , . , ? , . - Position.
Using operators or procedures depending on what they are working with is called polymorphism. When an existing operator, such as + or =, gets the opportunity to work with a new data type, they say that it is overloaded. Congestion in OOP is a type of polymorphism. She is his important feature.
The book on OOP "Object-oriented programming for dummies" will allow everyone to get acquainted with this topic in more detail.