define object orientated programming
a programming paradigm based on the concept of ‘objects’ which can contain data and code.
It attempts to group data and informations into structure items known as objects
What is an object in OOP
a specific instance of a class that contains attributes and methods
what is a class
a blueprint/ template for creating objects, defining attributes and methods
Define polymorphism
the ability of different classes to be treated as instances of the same class through a common interface
What is abstraction in OOP
the concept of hiding complex implementation details while exposing only the necessary parts
True or false: method overloading allows multiple methods with the same name in a class.
TRUE
methods must differ in the type or number of parameters
what does constructor do
method that is called when creating an instance of a class
what is composition in OOP
a design principle where a class is composed of one or more objects from other classes
what is the purpose of access modifiers
Private and Public, they control the visibility and accessibility of class members
to implement encapsulation (requiring modification through controlled methods like setters and getters),
protect data integrity by preventing direct unauthorized access,
manage code complexity,
and defining the interface for interacting with objects.
What is a getter
a method that retrieves the value of an object’s attribute
Fill in the blank: a setter is used to _______ the value of an attribute
set
define an abstract class
a class that cannot be instantiated and may contain abstract methods
what is inheritance
when a class hass attributes and methods from its parent class and it can have its own methods and attributes too
it extends a parent class by inheriting its features
what does overriding mean in OOP
redefining an inherited method (from a parent/ superclass) within a subclass to provide a different implementation
What is dependency injection
a technique where an object receives its dependencies (object that another class requires to function) from an external source rather than creating them
a procedure that starts with “public procedure new (givenName,givenAddress)” is called what
a construction
benefit of OOP
it becomes very easy to reuse the class and create hundreds of objects of that same class
what is ‘encapsulation’ in object-oriented programming
all of the object’s attributes are contained and hidden in the object by giving them the private access modifier
they are accessed through public getter and setter methods
encapsulation helps in protecting the integrity of the object’s data.
define ‘instantiation’
creating a specific, usable instance (object) from a class blueprint, using the word ‘new’
This is a fundamental concept in object-oriented programming.
what is an ‘attribute’
a specific piece of data representing a particular characteristic of an object
attributes are often referred to as properties or fields
what is a ‘constructor’
a method that is called when an object is created, typically to intialise its attributes
ofen called ‘new’
what is an object
a specific instance of a class
objects are created based on the structure defined by their class
what does OOP stand for
and what is it
Object-Oriented Programming
this is a programming paradigm which classifies real-world objects into classes and encapsulates the object’s attributes and behaviors
what are methods in a class
e.g. getters and setters and other subroutines that define the behavior of the object
methods are functions defined within a class that operate on the object’s attributes