lecture 7 Flashcards

1
Q

What Is Inheritance?

A

Provides a way to create a new specialized version class from an existing class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  • Inheritance establishes an …………relationship between classes.
  • ………. (or parent ) – inherited from
  • ………..(or child ) – inherits from the base class
  • An object of a …………….’is a(n)’ object of the ……………..
  • A ………… has all of the characteristics ,of the
    base class
  • An object of the derived class HAS all …………..and …………..in the parent class
  • An object of the derived class CAN USE …………… and ……………….in the parent class
A
  • “is a”
  • Base class
  • Derived class
  • derived class ,base class
  • derived object
  • defined and declared members
  • PUBLIC defined and declared members
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

1) …………..– object of derived class can be treated
as object of base class
2) …………..- object of parent class canNOT be treated as oject of derived class
3) ……………. – more restrictive than public,
but allows derived classes to know details of
parents
4) …………. – prevents objects of derived class
from being treated as objects of base class.

A
  • public
  • public
  • protected
  • private
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  • ……………members are accessible only within the class in which they are defined.
  • ………… are accessible within the class and its derived classes
  • …………………..determines how private, protected,
    and public members of base class are inherited by the derived class
A

private
Protected members
Class access specification:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  • overloading is allowed in (destructors / constructors)
  • only oe of it is allowed per a class (destructors / constructors)
  • Name is tilde (~) followed by the class name (destructors / constructors)
  • Receives no parameters, returns no value (destructors / constructors)
  • can Receive initialization parameters, but returns no value (destructors / constructors)
A
  • constructors
  • destructors
  • destructors
  • destructors
  • constructors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  • Derived classes can have their own constructors and destructors
  • When an object of a derived class is created, the ………….class’s constructor
    is executed first, followed by the……… class’s constructor
  • When an object of a derived class is destroyed, ………….. class’s destructor is executed first, followed by the……… class’s destructor
A

base ,derived
derived , base

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

what isa static binding?

A

also known as early binding or compile-time binding, function to be called is determined based on the type of the variable, rather than the type of the object it points to.

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