Practical Session 2 Class Design

Slides:



Advertisements
Similar presentations
Object Oriented Programming
Advertisements

Chapter 14 Graph class design John Keyser’s Modifications of Slides by Bjarne Stroustrup
Inheritance Lakshmish Ramaswamy. Example A Rectangle class with area method A Circle class with area method Array containing references to circles & rectangles.
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
Inheritance COMP53 Sept Inheritance Inheritance allows us to define new classes by extending existing classes. A child class inherits all members.
1 Inheritance Inheritance is a natural way to model the world in object-oriented programming. It is used when you have two types of objects where one is.
UML-diagrams Unified Modelling Language Used for Classes Objects.
UML Class Diagram: class Rectangle
2 D shapes only have two dimensions, such as width and length Some are: Polygons and Some are: Not Polygons.
2.5 OOP Principles Part 2 academy.zariba.com 1. Lecture Content 1.Polymorphism 2.Cohesion 3.Coupling 2.
Using Jeroo To Teach Object-Oriented Concepts By Christian Digout.
CPS Today’s topics Java Language Inheritance Upcoming Electric Circuits (not in text) Reading Great Ideas, Chapters 5.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Inheritance and Class Hierarchies Ellen Walker CPSC 201 Data Structures Hiram College.
Inheritance CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
C++ Review Classes and Object Oriented Programming Parasol Lab, Texas A&M University.
UML Review – class diagrams SE 2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
Chapter Two The UML – Unified Modeling Language Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
By. Circle Draw a circle in the box Tell about its attributes: sides, angles, whether or not it’s a polygon. Add any additional information you know about.
Information Systems Engineering
Chapter 10 Inheritance and Polymorphism
Peyman Dodangeh Sharif University of Technology Fall 2014.
AVERY TATE SHAPES. SQUARE CIRCLE TRIANGLE OVAL.
CSE 219 Computer Science III UML. UML Diagrams UML - Unified Modeling Language UML diagrams are used to design object-oriented software systems –represent.
Inheritance and Subclasses CS 21a. 6/28/2004 Copyright 2004, by the authors of these slides, and Ateneo de Manila University. All rights reserved L16:
Repeating patterns Can you work out the next shape in the pattern?
OBJECT ORIENTED PROGRAMMING. Design principles for organizing code into user-defined types Principles include: Encapsulation Inheritance Polymorphism.
1 Inheritance Inheritance is a natural way to model the world in object-oriented programming. It is used when you have two types of objects where one is.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
CSC241 Object-Oriented Programming (OOP) Lecture No. 17.
By Mackenzie.  Defining Attributes:  6 flat faces  8 vertices  12 edges  Stacks and slides  Shape of faces is a square.
How many …?. What shape can you see? I can see some _____. Q1 Q1 stars.
SHAPES There are many shapes in our world. These are circles. Circles are never ending lines.
CSC 143 O 1 CSC 143 Inheritance and Object Oriented Design.
CS 116 Object Oriented Programming II Acknowledgement: Contains materials provided by George Koutsogiannakis and Matt Bauer.
Abstract classes only used as base class from which other classes can be inherit cannot be used to instantiate any objects are incomplete Classes that.
UML Review – class diagrams SE-2030 Dr. Mark L. Hornick 1.
CS 350 – Software Design UML – The Unified Modeling Language – Chapter 2 The Unified Modeling Language is a visual language used to create models of programs.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Object Oriented Development, Abstraction & Inheritance
Unified Modeling Language (UML)
Here you can learn all about 2-D shapes
Analysis and Design with UML: Discovering Classes and Relationships
Polymorphism.
Road Map Inheritance Class hierarchy Overriding methods Constructors
Analysis and Design with UML: Discovering Classes and Relationships
Name the shape below. rectangle rhombus square triangle A B C D
UML Class Diagram: class Rectangle
Analysis and Design with UML: Discovering Classes and Relationships
Basic Shapes ©
Software Engineering Lecture #11.
HYBRID INHERITANCE : AMBIGUITY REMOVAL
Here you can learn all about 2-D shapes
Unified Modelling Language
Let’s play with shapes! play.
Shapes.
Inheritance: Polymorphism and Virtual Functions
Analysis and Design with UML: Classes and Relationships
Adapter Design Pattern
Area and Perimeter Ten quick questions.
SPLITTING OF COMBINED SHAPES
SHAPES By: Ms. Conquest.
Area of Composite Figures
Counting Shapes.
Can you work out the next shape in the pattern?
INTERFACES Explained By: Sarbjit Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
From Class Diagram to Contract Diagram
2D Shapes Rectangle Circle Triangle Rectangle. What shape is the door? Rectangle.
Can you work out the next shape in the pattern?
Presentation transcript:

Practical Session 2 Class Design

UML Basics UML - Unified Modeling Language

Class Diagram Name Car Fields Methods - engineSize : int - maxSpeed : int # getMaxSpeed() : int + drive() Permissions notation: + public, - private, # protected.

C has a collection of objects of type D 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 Wheel - engineSize : int - maxSpeed : int + drive() # getMaxSpeed() : int Wheel - airPressure: double + roll() 4

Inheritance Base Car Derived Ferrari

Interface Implementation Vehicle Implementation Car

Abstract Class Name* Car * Fields Non Abstract Methods - engineSize : int - maxSpeed : int # getMaxSpeed() : int + drive() *

Shape Hierarchy example

ShapeBase * - canv : Canvas - offset : Point + draw() * + delete() * + move(p: Point) Shape draw() delete() move(p: Point) n Polygon Point Circle Triangle Rectangle Square