Logo
Pattern

Discover published sets by community

Explore tens of thousands of sets crafted by our community.

Basics of Object-Oriented Programming (OOP)

10

Flashcards

0/10

Still learning
StarStarStarStar

Object

StarStarStarStar

An object is an instance of a class. It has state and behavior as defined by its class and is a basic unit of Object-Oriented Programming. Example: An object 'johnDoe' of class 'Customer' with name 'John Doe' and methods for making purchases.

StarStarStarStar

Association

StarStarStarStar

Association is a relationship where all objects have their own lifecycle and there is no owner. A change in one object's lifecycle does not affect the other; they are merely linked by their functionalities. Example: A 'Teacher' and a 'Department', where a teacher can belong to multiple departments or none at all.

StarStarStarStar

Composition

StarStarStarStar

Composition is a more restrictive form of Aggregation where the part cannot exist without the whole. It implies ownership and lifecycle dependency. Example: A 'House' and 'Rooms'—'Rooms' don't make sense without a 'House'.

StarStarStarStar

Constructor

StarStarStarStar

A constructor is a special method called when a new object of a class is created. It initializes the object's properties. Example: In a 'Person' class, a constructor will set the initial values of properties like 'name' and 'age'.

StarStarStarStar

Aggregation

StarStarStarStar

Aggregation is a specialized form of Association where all objects have their own lifecycle, but there is an ownership. It represents a 'whole-part' relationship. Example: A 'Library' and 'Books'—a 'Library' can exist without 'Books', but 'Books' are part of the 'Library'.

StarStarStarStar

Class

StarStarStarStar

A class is a blueprint for creating objects (a particular data structure), providing initial values for state (member variables or attributes), and implementations of behavior (member functions or methods). Example: A 'Customer' class with attributes like name and address and methods like 'makePurchase()'.

StarStarStarStar

Polymorphism

StarStarStarStar

Polymorphism allows objects to be treated as instances of their parent class rather than their actual class. The two types are dynamic (run-time) and static (compile-time). Example: A function to 'Draw' that behaves differently whether it's passed a 'Circle' or a 'Square'.

StarStarStarStar

Abstraction

StarStarStarStar

Abstraction involves hiding complex implementation details and showing only the necessary features of an object. It helps to reduce programming complexity and increase efficiency. Example: A 'CoffeeMachine' interface that has a method 'makeCoffee()' without exposing the complex internals.

StarStarStarStar

Encapsulation

StarStarStarStar

Encapsulation is the concept of bundling the data (variables) and the methods (functions) that use the data into a single unit called class. It also controls the access to that data. Example: A class 'BankAccount' that exposes methods like deposit() and withdraw() but keeps the balance private.

StarStarStarStar

Inheritance

StarStarStarStar

Inheritance is a mechanism where a new class inherits the properties and behavior of another class. The new class is called the derived or child class, and the existing class is the base or parent class. Example: A 'Car' class inherits from a 'Vehicle' class, acquiring its attributes and methods.

Know
0
Still learning
Click to flip
Know
0
Logo

© Hypatia.Tech. 2024 All rights reserved.