Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
*NO of arguments
*code Reusability
Relations are two types :Has-A relation
Is-A relation
Has-A relation:
It is a type of relation where the objects are related to each other based on the
dependency of one object over the another object,
Relations are used to relate one class to another class
Relations are used to acheive two goals
reduce the no lines of codes
code reusability
two types of relations:
Has-A relation:it is a type of relation where the objects are related to each other
based on the dependency of one object to another object.
Two types:Aggregation:
it is a type of relation where existance of one object is not
strongly dependent upon another object
Aggregation is acheived by creating global static reference
variable that points to the another class.
composition:It is a type of relation where the existance of one object is strongly
dependent upon another object
composition is acheived by creating global static reference variables
that points to another class
Super Statement:
it creates the object of an super class or parent class around which child class
object is created
The super statement also called as the constructor of super class or parent class
from constructor of child classor sub class
with in the subclass constructor we cannot write multiple super statements.Because
it will create the object of super classes multiple times.
super statement should be written at the first line of the constructor body
super statement can be wriiten explicity by the programmer and implicity by the
compiler
subclass construtor calling super class and super class construcor calling object
class constructor is called constructor chaining.
METHOD overloading:
Developing multiple methods with in a same class with the same name which may
differ in
1.NO of arguments
2.datatype of an arguments
3.order of an arguments
is called method overloading
*Two overloaded methods can have different return types.
*can have different acccess specifiers
*can have different access modifiers.
ADVANTAGE:
To perform same task in a class using different arguments we did not need
to to remember multiple method names
DISADVANTAGE:
As a developer for every each and every single class we have to maintain
documentation which is time consuming process
b It takes lots of time for the developer to understand the behaviour of
every overloaded methods without any documentations.