Allow you to create and instantiate an
object
↳ Instantiate stored for the
:
Attributes object
when object is instantiated : Constructor called
Attributes of Constructor Declared
:
as
public
same name as class
Types of Constructors
↳ Default :
No parameters : Initialised with default values
Parameterised Constructor contains to values
parameters assign
:
Method
Overloading
2+ Methods in class with same name but different
parameters
↳ Increases of
readability program
Different ways to overload
:
Change num .
of
arguments
change data
type
E. + Person C)
g.
string)
+ Person ( f- Name
Name DOB
string string
: :
:
s
, ,
Method Overriding
Implementing a method in a derived class with same
signature as base class method
↳ Override base functionality
class with new functionality
Allows new method to
give different results to
super class
Rules :
Same method name as in parent
same parameters
Must be inheritance