64,637
社区成员
发帖
与我相关
我的任务
分享
What, then, is object-oriented programming (OOP)? We define it as follows:
Object-oriented programming is a method of implementation in which programs
are organized as cooperative collections of objects, each of which represents an
instance of some class, and whose classes are all members of a hierarchy of
classes united via inheritance relationships.
There are three important parts to this definition:
(1) Object-oriented programming uses objects, not algorithms, as its fundamental logical building blocks (the “part of” hierarchy we introduced in Chapter 1);
(2) each object is an instance of some class; and
(3) classes may be related to one another via inheritance relationships
(the “is a” hierarchy we spoke of in Chapter 1). A program may appear to be
object-oriented, but if any of these elements is missing, it is not an object-oriented program. Specifically, programming without inheritance is distinctly not objectoriented; that would merely be programming with abstract data types.