oop lecture 3 Flashcards

1
Q

what is inheritance

A

Inheritance is a basic concept of object-oriented
programming
* Inheritance allows a class to have a parent class from
which it can inherit variables and methods

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

example of inheritance in classes

A
  • If a class B inherits from class A then it contains all the
    characteristics (information structure and behavior) of
    class A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

inheritance in classes

A

parent class= base class
child class=derived class

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

advantages of inheritance

A

able to reuse
less redundancy
increase in maintainability

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

class extension

A

members of a subclass can inherit variables and methods of their super-class

an have their own special instance variables
and methods that are not present in the super-class

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

class extension example

A

public class employee EXTENDS person

employee is a subclass of person
person is a super class of employee

employee inherits from person

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

inheritance and instance variables

A

An instance of a subclass stores all the instance
variables of the super-class (even private ones),
plus all the instance variables defined in the
subclass

private instance variables of
the super-class are NOT INHERITED

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

access modifier

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