Key Concepts in Object-Oriented Programming
Functions
A function is part of a program with a name. It can be invoked from another part of the program as often as desired. A function is a block of code that can be run as a functional unit, receive values, execute, and return a value.
Arrays
An array is a set of data that is stored contiguously in memory under the same name.
Concurrency
Concurrency distinguishes an active object from a non-active one and allows multiple objects to act concurrently.
Abstraction
Abstraction takes the most important aspects and describes the behavior of objects.
Encapsulation
Encapsulation is the process of grouping related data and operations under the same program unit.
Inheritance
Inheritance is a mechanism that implements the property of generalization, defining a new class from an existing one.
Polymorphism
Polymorphism refers to an operation that has the same name in different classes but runs differently in each class.
Persistence
Persistence is the property by which an object’s existence transcends time after its creator ceases to exist.
Object
An object is a generic encapsulation of data and procedures for handling them.
Message
Message passing between objects leads to changes in the object’s state.
Protocol
A protocol is a set of messages to which an object can respond.
Method
A method determines how an object should act when it receives a message.
Operation
An operation occurs when a method sends a message to another method, requesting information or action.
Class
A class can be considered a template for generating objects.
Instance
An instance is a generalization of a specific type of object for the creation of another class.
Static
Static is an attribute type that receives a data member name.
Subclass
A subclass defines an object-oriented system with a hierarchical classification where the child class inherits the attributes and methods of its parent class.
Sections of a Class
Private Section
Only member functions of the class can access private members. Descendant classes are denied access to the private members of a class.
Protected Section
Only member functions of a class and its descendant classes can access protected members.
Public Section
Specified members are visible to the member functions of a class.
Class Rules
- Sections of the class can appear more than once in any order.
- If you do not specify a section in C++, members are treated as private.
- Data members should be avoided in the public section unless such a declaration fully simplifies the design. Data members are usually placed in the protected section to allow member functions and dependent classes access.