100 likes | 226 Views
Practical Session 2 Class Design. UML Basics UML - Unified Modeling Language. Class Diagram. Name Fields Methods. Car. - engineSize : int - maxSpeed : int. # getMaxSpeed() : int + drive(). Permissions notation : + public, - private, # protected. Relations. A. B.
E N D
Class Diagram Name Fields Methods Car - engineSize : int - maxSpeed : int # getMaxSpeed() : int + drive() Permissions notation: +public, - private, # protected.
Relations A B A has an object of type B n C D C has a collection of objects of type D
Relations example Car - engineSize : int - maxSpeed : int + drive() # getMaxSpeed() : int Wheel - airPressure: double + roll() 4
Inheritance Base Car Derived Ferrari
Interface Implementation Interface Vehicle Implementation Car
Abstract Class Name* Fields Non Abstract Methods Abstract methods * Car * - engineSize : int - maxSpeed : int # getMaxSpeed() : int + drive() *
ShapeBase * - canv : Canvas - offset : Point + draw() * + delete() * + move(p: Point) Shape draw() delete() move(p: Point) n Polygon Point Circle Triangle Rectangle Square