# presentation8 - Objects and Classes Soheil Hassas Yeganeh...

This preview shows pages 1–13. Sign up to view the full content.

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

View Full Document

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

View Full Document

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

View Full Document

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Objects and Classes Soheil Hassas Yeganeh Computer Engineering Department Sharif University of Technology Object vs Class (1) 2 Circle---------------- radius radius=150 radius=100 Object vs Class (2) 3 Circle---------------- radius Shape---------------- color Object vs Class (2) 3 Circle---------------- radius Shape---------------- color color = yellow Object vs Class (2) 3 Circle---------------- radius Shape---------------- color radius=150 color = yellow Object vs Class (2) 3 Circle---------------- radius Shape---------------- color radius=150 color = white color = yellow The Problem 4 The Problem • We need a library to support ordinary operations with geometric shapes . • Let us design it using object oriented approach. • How can we do this? What are the steps ? 4 Informal OOD Steps (1) 5 1. We want to support 4 types of shapes for now: Triangle , Square , Circle , Rectangle . 2. The program should compute the area and circumference of the shapes. 3. The color of the shapes should also be saved. Informal OOD Steps (1) • Establish Objectives and Goals . • What should be supported ? • What are desirable/ undesirable features ? • What do the users need ? 5 1. We want to support 4 types of shapes for now: Triangle , Square , Circle , Rectangle . 2. The program should compute the area and circumference of the shapes. 3. The color of the shapes should also be saved. Informal OOD Steps (2) 6 T r i a n g l e S q u a r e R e c t a n g l e C i r c l e A r e a c i r c u m f e r e n c e C = 2 X π X r A = π X r 2 C = 2 X (a+ b) A = a X b C = 4 X a A = a 2 C = a + b + c A = h X c E v e r y s h a p e h a s a c o l o r ! Informal OOD Steps (2) • Write down any concept, you identify in your problem!...
View Full 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 / 45

presentation8 - Objects and Classes Soheil Hassas Yeganeh...

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

View Full Document
Ask a homework question - tutors are online