Encapsulation And Inheritance Flashcards
define encapsulation
the process of wrapping data and functions together as a unit
how can encapsulation be made possible
by declaring the class members as private
private visibility supports what
data hiding, as once data members are declared private, their accessibility remains limited up to the class block
define scope of variable
refers to the extent of their usage in a program
define instance variables
the variables that are declared within a class, outside the member methods. AKA data members
they are automatically allocated as individual copy of each object of the class
scope of use of private
within the scope of class
scope of usage of public
accessed outside of class visibility
scope of usage of protected
used simply as private members within the class in which they exist, but can be accessed to derived class
define class variable
declared within the class along with a keyword static .
AKA static data member
difference between static and non static instance variable
static: common copy for all objects of the class
non static: separate copy for all objects
define local variable
a variable that is declared within a function or method
hold values temporarily during any operation
define inheritance
a process by which some properties of a class are shared by another class or classes is known as inheritance
define base class and derived class
a base class is inherited by another class
a derived class or Target/ sub class inherits from a base class
types of inheritance
- single inheritance
- multiple inheritance
- hierarchical inheritance
- nested/multilevel inheritance
- hybrid inheritance