| |
|
What is inheritance?
Inheritance - is the concept of passing the traits of a class
to another class.
A class comprises of a collection of types of encapsulated instance
variables and types of methods, events, properties, possibly with implementation of those
types together with a constructor function that can be used to create objects of the class.
A class is a cohesive package that comprises of a particular kind of compile-time metadata.
A Class describes the rules by which objects behave; these objects are referred to as "instances"
of that class. (Reference)
Classes can inherit from another class. This is accomplished by putting a colon after the class
name when declaring the class, and naming the class to inherit from—the base class—after
the colon. (Reference)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| |