lecture 7 Flashcards
What Is Inheritance?
Provides a way to create a new specialized version class from an existing class
- 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
- “is a”
- Base class
- Derived class
- derived class ,base class
- derived object
- defined and declared members
- PUBLIC defined and declared members
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.
- public
- public
- protected
- private
- ……………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
private
Protected members
Class access specification:
- 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)
- constructors
- destructors
- destructors
- destructors
- constructors
- 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
base ,derived
derived , base
what isa static binding?
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.