Lecture 1 Flashcards
What is OOP
Object-Oriented Programming (OOP) is a programming paradigm that models software design around objects, representing real-world entities, and their interactions.
What are the charateristics of OOP
Classes
Objects
Methods
Constructors
Encapsulation
Polymorphism,
Abstraction,
Encapsulation,
Message passing
Data Binding
What is a class in OOP?
A class is a blueprint or template that defines the attributes (properties or fields) and behaviors (methods or functions) common to all objects of a certain type.
What is an object in OOP?
An object is an instance of a class that has its own state and behavior, representing a real-world entity.
What is a method in OOP?
A method is a block of code that performs a specific task or set of tasks.
What are the characteristics of a method?
Characteristics of a method include a unique name, return type, parameters, access modifiers, and can be static (belonging to the class itself) or instance(asscoiated with an object of the class) methods. Methods can also be overloaded.
What is a constructor?
A constructor is a special member function in a class that is automatically called when an object of that class is created.
What is encapsulation?
Encapsulation involves bundling the data (attributes) and methods that operate on the data within a single unit (class) and restricting direct access to the internal state.
What is polymorphism?
Polymorphism is the ability of an object to take on multiple forms,
allowing objects of different types to be treated as objects of a common type through method overloading and method overriding.
What is abstraction in OOP?
Abstraction allows you to represent complex real-world objects in a simplified manner by focusing on essential details and ignoring non-essential details.
How can abstraction be implemented in OOP?
Abstraction can be implemented through abstract classes, interfaces, and regular classes with private methods.
What is message passing in OOP?
Message passing is a mechanism by which objects communicate with each other by sending and receiving messages.
What is inheritance in OOP?
Inheritance is a mechanism that allows a new class to be based on an existing class. Types include single, multiple, multilevel, hierarchical, and hybrid inheritance.
What are access modifiers?
Access modifiers are keywords that control the visibility of class members (e.g., variables, methods).
What are the different types of access modifiers in Java?
The types of access modifiers in Java are public, default, protected, and private.