OOP Flashcards
OOP
Object-oriented programming (OOP) attempts to group information, data and code into structured items known as objects.
difference between object and class
A class is a blueprint for declaring and creating objects while an object is a class instance that allows programmers to use methods from inside the class.
Attributes
Data stored inside a class or object.
Methods
A set of instructions that complete a task, associated with an object
Encapsulation
Encapsulation is the bundling of data with the methods that operate on and restrict direct access to it.
It is used to hide the values or internal state of an object, preventing direct access by unauthorised parties
Inheritance
allows a class (called a subclass or derived class) to inherit all the methods and attributes of another class (called a superclass or base class) which can have its own additional properties.
Information hiding
the process of hiding all details of an object that do not contribute to its essential characteristics.
Private Members: Some programming languages provide mechanisms to designate certain attributes or methods as “private,” meaning they can only be accessed within the same class or object. This prevents external code from directly manipulating or accessing these internal details.
Polymorphism
means objects can behave differently depending on their class.
This can result in the same method producing different outputs depending on the object involved.
Overriding (dynamic polymorphism)
redefining a method within a subclass and altering the code so that it functions differently and produces a different output.