presentation16 - Interfaces Soheil Hassas Yeganeh Computer...

Info iconThis preview shows pages 1–16. Sign up to view the full content.

View Full Document Right Arrow Icon
Interfaces Soheil Hassas Yeganeh Computer Engineering Department Sharif University of Technology
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Interfaces 2
Background image of page 2
Interfaces We have talked about interfaces in past sessions. What was called the interface of an object? Why do we use them? 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A Question 3
Background image of page 4
A Question What are the interfaces of the Shape sample ? 3
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Answer (1) 4 getColor() getCircumference() Triangle Square Rectangle Circle getArea()
Background image of page 6
Answer (1) Any public method can be chosen as an interface. getColor is different from getArea and getCircumference. Related behaviors are collected in an interface . 4 getColor() getCircumference() Triangle Square Rectangle Circle getArea()
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Answer (2) 5 Shape Circle Square Rectangle Triangle Colorable
Background image of page 8
Answer (2) Any object that have a color has the Colorable interface. Any object that can compute area , and circumference has the Shape interface. 5 Shape Circle Square Rectangle Triangle Colorable
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Another Question 6
Background image of page 10
Another Question Is there any object that has two interfaces not in a hierarchy ? 6
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Answer (2) 7 Bird LivingThin g FlyingThin g Aircraft Human
Background image of page 12
Answer (2) Birds are alive , and also can fy . So, they eat ! and fy ! 7 Bird LivingThin g FlyingThin g Aircraft Human
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java and Interfaces 8
Background image of page 14
Interfaces are used for specifying a behavior that will be implemented using different classes that are not necessarily in a hierarchy . 8
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 16
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/21/2010 for the course COMPUTER S 003 taught by Professor Izadi during the Spring '10 term at Amirkabir University of Technology.

Page1 / 38

presentation16 - Interfaces Soheil Hassas Yeganeh Computer...

This preview shows document pages 1 - 16. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online