SE601 Week 2
SE601 Week 2
development Practical
Week 2
Information sharing between objects
In object-oriented programming, objects can share information with each other through
various means, such as method calls, parameter passing, and message passing.
● Method calls allow one object to call a method of another object, passing any
necessary parameters as arguments. This allows the receiving object to use the
information provided by the calling object to perform some action.
● Parameter passing allows one object to pass data directly to another object,
such as passing an object reference to a method. This allows the receiving object
to use the data provided by the calling object to perform some action.
● Message passing is another way for objects to communicate with each other. In
this case, one object sends a message to another object, which can then process
the message and take some action based on its contents.
Data Sharing- UseCase
Generalization
class Animal {
// eat() function
// sleep() function
};
};
Realization
// Drivable.java
}}
Polymorphism