C++ OOP Flashcards
What is the area of a circle?
Pi (radius)squared
What is the input symbol for a double?
â%fâ
What is Pi?
3.14
How do you do inheritance in cpp?
class className: public classname(to inherit), public classname(to inherit){
}
If a child class inherits from a parent class, how does it call a function specific to the parent class, even if it is inheriting from multiple parents?
parentClassName::method() ;
what is the :: operator and what is it used for?
It is called the scope operator and it is used in multiple inheritance to specify the class and which function from said specified class to called.
What is an abstract class?
An abstract class is a special type of class from which objects cannot be directly created but rather it meant for other classes to inherit from.
What are 2, characteristics of abstract classes?
-> You cannot create an object directly from it
-> It can contain pure virtual functions
How is a virtual function written in cpp?
virtual returntype functionName() = 0 ;
What are the core concepts of OOP?
A-PIE
Abstraction
Polymorphism
Inheritance
Encapsulation
What are the 3 main access modifies in cpp and what are their scopes?
Protected -> accessible within a class, and any class that inherits from it
Private -> accesible only within the class
Public -> accessible anywhere in the code