Basic concepts of OOP: "class", "object", "interface"
A class is a way to describe an entity, defining the state and behavior that depends on this state, as well as the rules for interacting with this entity (contract).
From a programming point of view, a class can be viewed as a set of data (fields, attributes, class members) and functions for working with them (methods).
From the point of view of program structure, a class is a complex data type.
An object (instance) is a separate representative of a class with a specific state and behavior that is completely determined by the class. Each object has specific attribute values and methods that operate on those values based on the rules defined in the class.
An interface is a collection of class methods available for use. The interface of a class will be a set of all its public methods together with a set of public attributes. Basically, an interface specifies a class, clearly defining all possible actions on it.
Read also:
- Basic principles of OOP
- What is "encapsulation"
- What is "inheritance" in OOP
- What is "polymorphism" in OOP
- What is messaging in OOP
Comments
Post a Comment