LESSON 4 Flashcards

1
Q

One of the core concepts in object-oriented programming is inheritance

A

Inheritance

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

It is a mechanism that allows you to create a hierarchy of classes that share a set of _____ and _____ by deriving a class from another class

A
  • Inheritance
  • properties
  • methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

the class whose features are inherited by other classes

A

SuperClass(Parent/BaseClass)

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

The class that inherits the features of other classes. ______ can also have their own features in addition to the inherited ones.

A

Sub Class (Child Class)

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

The concept where we can derive a new class from existing classes

A

Reusability

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

represents real-world relationships well.

A

Inheritance

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

Inheritance

  • It provides the _____ of a code. We don’t have to write the same code
    again and again. Also, it allows us to _______ to a class without
    modifying it.
A
  • Inheritance
  • reusability
  • add more features
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

which means that if class Y inherits from another class X, then all the subclasses of Y would automatically inherit from class X.

A
  • Inheritance
  • transitive in nature
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

To further understand this mechanism of OOP, we use the ______ , where we create a subclass by including the name of the parent class as a ______

A
  • Inheritance
  • IS-A relationship
  • parameter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

● A child class needs to identify which class is its parent class.
● This can be done by mentioning the parent class name in the definition of the child class.

A

Subclassing

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

In order to properly use the attributes of the parent class, you must either

A

● Invoke the constructor of the parent class
● Do not create a constructor for the subclass and use Getters and Setters instead.

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

If you forget to invoke the _______ of the parent class then its instance variables would not be available to the child class

A
  • Subclassing
  • __init__()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

to access the parent’s class methods and
functions.

A
  • super()function
  • Subclassing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

five types of inheritance

A

● Single Inheritance
● Multiple Inheritance
●Multilevel Inheritance
● Hierarchical Inheritance
● Hybrid Inheritance

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

enables a derived class to inherit properties from a single parent class, thus enabling code reusability and the addition of new features to existing code.

A

Single Inheritance

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

When a class is derived from more than one base class, this type of inheritance is called ________

A

Multiple Inheritance

13
Q

features of the base class and the derived class are further inherited into the new derived class.

A

Multilevel Inheritance

14
Q

In Multilevel Inheritance, This is similar to a relationship representing ________

A

child and grandfather

15
Q

more than one derived class are created from a single base, this type of inheritance

In this program, we have a parent(___) class and two or more child (____) classes.

A
  • Hierarchical Inheritance
  • base
  • derived
16
Q

The word polymorphism means having _________

A

many forms

16
Q

Inheritance consisting of multiple types of inheritance

A

Hybrid Inheritance

16
Q

means the same function name (but different signatures) being used for different types.

A

Polymorphism

17
Q

In such cases, we re-implement the method in the child class. This process of re-implementing a method in the child class is known

A

Method Overriding.