Inheritance

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/36

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:27 PM on 5/4/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

37 Terms

1
New cards

What is inheritance in C++?

Reusing and extending existing class definitions

2
New cards

A class that is inherited from is called a:

Base class

3
New cards

A class that inherits from another class is called a:

Derived class

4
New cards

In inheritance, a derived class automatically gets:

Both attributes and methods

5
New cards

Which relationship best describes inheritance?

is‑a

6
New cards

Which is an example of inheritance?

Dog is an animal

7
New cards

Which relationship represents aggregation/composition?

has‑a

8
New cards

If class B is derived from class A, A is called:

Base class

9
New cards

A class derived from another derived class is called:

Multi‑level derived class

10
New cards

A derived class object contains:

Both base class and its own members

11
New cards

Private members of a base class are:

Not accessible in derived classes

12
New cards

Protected members are accessible in:

Derived classes

13
New cards

Which access specifier allows access in derived classes but not outside?

protected

14
New cards

Default inheritance access specifier for a class is:

private

15
New cards

Default inheritance access specifier for a struct is:

public

16
New cards

When a base class is inherited as public:

Access levels remain unchanged

17
New cards

When a base class is inherited as protected:

Public and protected become protected

18
New cards

When a base class is inherited as private:

Public and protected become private

19
New cards

Private members of a base class:

Cannot be accessed anywhere else

20
New cards

The 'has‑a' relationship is best implemented using:

Composition or aggregation

21
New cards

Which is NOT a valid base class access specifier?

static

22
New cards

Which keyword allows changing access of inherited members?

using

23
New cards

A using declaration can:

Change access level of inherited members

24
New cards

Which statement is TRUE about inheritance?

Derived class extends base class functionality

25
New cards

Why should member variables usually be private?

Data hiding and integrity

26
New cards

What is the relationship between a base class and a derived class?

Base class provides attributes and methods

27
New cards

What keyword is used to inherit a class in C++?

class

28
New cards

What is the purpose of constructors in derived classes?

To initialize derived class objects while calling base class constructors

29
New cards

Which member function allows the derived class to access base class members?

Protected member functions

30
New cards

What happens if a derived class does not explicitly call the base class constructor?

The default constructor of the base class is called automatically.

31
New cards

Can a derived class override base class methods?

Yes, if they are declared virtual in the base class.

32
New cards

What is the purpose of the 'virtual' keyword in C++?

To enable dynamic binding of overridden methods.

33
New cards

What happens during the destruction of the derived class object?

The destructors are called in the reverse order of construction.

34
New cards

What is a pure virtual function?

A function with no implementation in the base class, making it abstract.

35
New cards

What is an abstract class?

A class with at least one pure virtual function.

36
New cards

What does 'multiple inheritance' allow in C++?

A derived class to inherit from more than one base class.

37
New cards

What is the potential issue with multiple inheritance?

The diamond problem, which causes ambiguity in method resolution.