Topic 05 – Continued.. Object Oriented Programming (OOPs) in C++

15 flashcardsby Clement
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
What is the main difference between procedural programming and object-oriented programming?
Procedural programming focuses on functions and data, while object-oriented programming focuses on objects containing both data and functions.
2
What is the DRY principle in programming?
The DRY (Don't Repeat Yourself) principle is about reducing code repetition by extracting common code and reusing it.
3
What is a class in C++?
A class is a template for objects, defining attributes and methods that can be inherited by objects.
4
What is an object in C++?
An object is an instance of a class that can access its attributes and methods.
5
What are attributes and methods in a class?
Attributes are variables, and methods are functions that belong to a class.
6
What is encapsulation in OOP?
Encapsulation is the process of wrapping data and functions together in a single unit and hiding the details from outside access.
7
What is abstraction in OOP?
Abstraction is the concept of displaying only essential information and hiding the background details or implementation.
8
What is polymorphism in C++?
Polymorphism is the ability of a function or operator to have multiple forms, such as function overloading and operator overloading.
9
What is operator overloading in C++?
Operator overloading is the process of making an operator behave differently based on the type or number of operands.
10
What is function overloading in C++?
Function overloading allows multiple functions to have the same name but with different parameters.
11
What is inheritance in OOP?
Inheritance is the capability of one class (subclass) to derive properties and behaviors from another class (superclass).
12
What is the benefit of inheritance in OOP?
Inheritance supports reusability, allowing new classes to reuse code from existing classes.
13
What are access specifiers in C++?
Access specifiers (public, private, protected) define the visibility of class members from outside the class.
14
What is an example of abstraction in C++?
An example of abstraction is using header files like math.h, where functions like pow() are used without knowing their internal algorithm.
15
What is the purpose of a constructor in a class?
A constructor is used to initialize the variables of a class when an object is created.
Study all 15 cards for free