You are on page 1of 1

Object-Oriented Programming 3 Classes (2 implementation + interface)

# of cylinders, # of wheels -> pass parameters


Tuesday, March 10, 2009
9:07 AM
3 Important Concepts in OOP:
1. Encapsulation
2. Inheritance
3. Polymorphism Class Radio03
- Interface
What is an Object-Oriented Program? - Instantiate Combo (composition)
- Consist of a group of co-operating objects, exchanging messages to achieve a common objective. - Radio03 has a Combo
Class Combo extends Radio03
What is an Object? - Combo is a Radio03 type object
- A software construct that encapsulates data, along with the ability to use or modify that data into a - Inherits methods from Radio03
software entity.

What is Encapsulation? Method Overriding: means you have two or more


- Encapsulation is the concept of that an object should totally separate its interface from its methods in a super class and or subclass which have the
implementation. All the data and implementation code for an object should be entirely hidden behind same name, with slightly refined functions; but the same
its interface. parameters. The version of the polymorphic method called
is the one closest to the call location.
State of an Object? Polymorphism: Multiple methods with the same name.
- An object has changed its state when one or more data values stored in the object have been modified. Method Overloading: 2 or more methods in a class or set
When an object responds to a message, it will usually perform an action, change its state return a value of classes which have the same name, but different
or some combination of the above. parameter lists.

Persistence?
- The ability of your car radio to remember your list of favourite stations is often referred to as
persistence. An object that has the ability to store and remember values is soften said to have
persistence.

Class Definition?
- A set of plans for an object allows you to mass produce lots of copies of the object.

Instance of a Class?
- An instance of a class - particular example of a software object.

Instantiate a Class?
- Produce an instance of a class.

Invoking a Method of an Object?


Public void playStation (in stationNumber)
//causes the specific station identified by the integer to be selected for play
//void - doesn't return a value
//public - available to outside modifiers.

myObRef.playStation(3) invokes this method, asks for station 3.

ICS4M0-A Page 1

You might also like