Object Oriented Programming using C#

(backadmin) #1
Object Oriented Programming using C#
Object Roles and the Importance of Polymorphism

An interface is a sort of contract. The SaleableItem interface says “I undertake to provide, at least, methods with these
signatures:

public void SellCopy ();
public double Price ();

though I might include other things as well”

Where more than one class implements an interface it provides a guaranteed area of commonality which polymorphism
can exploit.

Think of a car and a driving game in an arcade. They certainly are not related by any “is a” relationship – they are
entirely different kinds of things, one a vehicle, the other an arcade game. But they both implement what we could call a
“SteeringWheel interface” which we can use in exactly the same way, even though the implementation (mechanical linkage
in the car, video electronics in the game) are very different.

What do you want to do?


No matter what you want out of your future
career, an employer with a broad range of
operations in a load of countries will always
be the ticket. Working within the Volvo Group
means more than 100,000 friends and
colleagues in more than 185 countries all
over the world. We offer graduates great
career opportunities – check out the Career
section at our web site http://www.volvogroup.com.
We look forward to getting to know you!

AB Volvo (publ)www.volvogroup.com

VOLVO TRUCKS I RENAULT TRUCKS I MACK TRUCKS I VOLVO BUSES I VOLVO CONSTRUCTION EQUIPMENT I VOLVO PENTA I VOLVO AERO I VOLVO IT
VOLVO FINANCIAL SERVICES I VOLVO 3P I VOLVO POWERTRAIN I VOLVO PARTS I VOLVO TECHNOLOGY I VOLVO LOGISTICS I BUSINESS AREA ASIA

Please click the advert

Free download pdf