C++ OOP Flashcards

1
Q

What is the area of a circle?

A

Pi (radius)squared

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the input symbol for a double?

A

“%f”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Pi?

A

3.14

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you do inheritance in cpp?

A

class className: public classname(to inherit), public classname(to inherit){
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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?

A

parentClassName::method() ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is the :: operator and what is it used for?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an abstract class?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are 2, characteristics of abstract classes?

A

-> You cannot create an object directly from it
-> It can contain pure virtual functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is a virtual function written in cpp?

A

virtual returntype functionName() = 0 ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the core concepts of OOP?

A

A-PIE
Abstraction
Polymorphism
Inheritance
Encapsulation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the 3 main access modifies in cpp and what are their scopes?

A

Protected -> accessible within a class, and any class that inherits from it

Private -> accesible only within the class

Public -> accessible anywhere in the code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly