SEEM4570 System Design and Implementation. Lecture 11 From Design to Implementation
|
|
- Erick McCarthy
- 6 years ago
- Views:
Transcription
1 SEEM4570 System Design and Implementation Lecture 11 From Design to Implementation
2 Introduction We learned programming and we learned UML, but separately. Now, the question is how can we translate a design specification from UML to Implementation (i.e. programming)? In this lecture, we will focus on class diagram and use PHP for demonstration. PHP is chosen because its syntax is easy to understand and initiative Gabriel Fung. 2
3 Example 1 class { private $name; public function construct($name){ $this->name = $name public function getname(){ return $this->name; - name string + (name string) + getname() string $person = new ( John ); echo $person->getname(); // output John echo $person->name; // Error! name is private! Gabriel Fung. 3
4 Example 2 class { public $name; public function construct($name){ $this->name = $name public function getname(){ return $this->name; + name string + (name string) + getname() string $person = new ( John ); echo $person->getname(); // output John echo $person->name; // output John Gabriel Fung. 4
5 Example 3 class { protected $name; public function construct($name){ $this->name = $name public function getname(){ return $this->name; # name string + (name string) + getname() string $person = new ( John ); echo $person->getname(); // output John echo $person->name; // Error! name is protected! Gabriel Fung. 5
6 Note 1 By setting the variables into different kinds of visibilities (i.e. private, protected and public), we can control how the other programs can access the variables, and avoid other programs accidentally changed the variable. In Example 1, this will return an error $person->name = Mary ; So there is no valid way to change the name of the person. However, in Example 2, this is valid $person->name = Mary ; // the name is changed to Mary now For protected, we will explain it very soon Gabriel Fung. 6
7 Example 4 class Staff extends { private $salary; public function construct(salary, name){ $this->salary= $salary; $this->name = $name; public function getsalary(){ return $this->salary; $staff = new Staff( John ); echo $staff->getname(); // output John Staff - salary int echo $staff->name; // Error! name is private! # name string + (name string) + getname() string + Staff(salary int, name string) + getsalay() int Gabriel Fung. 7
8 Example 5 class Staff extends { private $salary; public function construct(salary, name){ $this->salary= $salary; $this->name = $name; // invalid! public function getsalary(){ return $this->salary; Staff - salary int - name string + (name string) + getname() string + Staff(salary int, name string) + getsalay() int Gabriel Fung. 8
9 Note 2 Did you know why it is valid to use $this->name (line 6) in Example 4? It is because name is a protected variable in the parent class, so that any classes that extend it can access this protected variable directly. To make Example 5 valid, we need to change the code a little bit. See the next eample Gabriel Fung. 9
10 Example 6 class Staff extends { private $salary; public function construct(salary, name){ $this->salary = $salary; parent construct(name); // valid public function getsalary(){ return $this->salary; Staff - salary int - name string + (name string) + getname() string + Staff(salary int, name string) + getsalay() int Gabriel Fung. 10
11 Example 7 interface { public function getname(); class Staff implements { private $name; private $salary; public function construct(salary, name){ $this->salary = $salary; $this->name = $name; public getname(){ return $this->name; Staff - name string - salary int <<interface>> + getname() string + Staff(salary int, name string) + getsalay() int Gabriel Fung. 11
12 Example 8 interface { public function getname(); // The class below is invalid! It did not // have the method getname() class Staff implements { private $name; private $salary; public function construct(salary, name){ $this->salary = $salary; $this->name = $name; Staff - name string - salary int <<interface>> + getname() string + Staff(salary int, name string) + getsalay() int Gabriel Fung. 12
13 Example 9 // The class below is invalid! // An interface cannot contain // implementation detail interface { private $name; public function getname(){ return $this->name; Staff - name string - salary int <<interface>> + getname() string + Staff(salary int, name string) + getsalay() int Gabriel Fung. 13
14 Note 3 In interface, we should not have any variable and should not have any constructor. We should not have any implementation detail as well. If you need to contain variables and implementation detail, you should write abstract class. Why interface is useful? It can make sure all classes that implemented a particular interface must contain all the methods specified in the implemented interface Gabriel Fung. 14
15 Example 10 abstract class { private $name; public function getname(){ return $this->name; class Staff extends { Note Italic! + getname() string Staff - name string - salary int + Staff(salary int, name string) + getsalay() int Gabriel Fung. 15
16 Note 4 Why interface and abstract class are useful? It can make sure all classes that implemented a particular interface must contain all the methods specified in the implemented interface Gabriel Fung. 16
17 Example 11 class { class Building{ private $securityguard; public function construct($guard){ $this->securityguard = $guard; Building - securityguard $person = new ( John ); $building = new Building($person); Gabriel Fung. 17
18 Example 12 class Room{ class Building{ private $room; public function construct($room){ $this->room = new Room(); Room Building - room Room Gabriel Fung. 18
19 Note 5 Can you identify the major difference between aggregation and composition? In aggregation, when an object that contains other objects is destroyed, those objects that are used inside will not destroy. In composition, when an object is destroyed, all associated objects will be destroyed as well Gabriel Fung. 19
20 Example 13 // This is correct class {... class Printer{... public function print(person){... Printer + print(person ) Gabriel Fung. 20
21 Example 14 // This is incorrect class {... public function print(printer){... class Printer{... public function print(person){... + print(printer Printer) Printer + print(person ) Gabriel Fung. 21
22 Example 15 // This is also incorrect class {... public function x(){ $printer = new Printer(); class Printer{... public function print(person){... + x() Printer + print(person ) Gabriel Fung. 22
23 Note 6 When the relationship is uni-directional from A to B (i.e. A > B), you should never refer to B from A Gabriel Fung. 23
24 Example 16 class {... public function getname(){ return $this->name; Professor class Professor{... + getname() string // override the previously defined method public function getname(){ return Prof.. $this->name; + getname() string Gabriel Fung. 24
25 Visibility and Encapsulation In UML class diagram, the symbol #, + and are known as visibility. In OOP, it is usually called Encapsulation. The ability of an object to hide its data and methods from the rest of the world The internal representation of an object is generally hidden from view outside of the object's definition. One of the fundamental principles of OOP Gabriel Fung. 25
26 Realization and Data Abstraction Example 7 and Example 10 are two examples of realization. In OOP, we usually call this as Data Abstraction Gabriel Fung. 26
27 Generalization and Inheritance Example 6 and Example 10 are two examples of generalization. You can use one class as the basic for another class. Multiple classes may share some of the same characteristics, and have things in common with one another, but also may have certain properties that make them different. In OOP, this is usually known as Inheritance Gabriel Fung. 27
28 Polymorphism In Example 16, we override a method that is defined in the parent class. In OOP, this is known as Polymorphism. Polymorphism is the ability to create a variable, a function, or an object that has more than one form. The most common cases are Method Overriding Re-define the method in a subclass (Example 16) Method Overloading (Not in PHP) Define some methods with the same name but different number of arguments Gabriel Fung. 28
29 More About OOP Encapsulation, Data Abstraction, Inheritance and Polymorphism are four major properties of OOP. Note that not all OOP must necessarily contains all these properties Gabriel Fung. 29
Object Orientated Analysis and Design. Benjamin Kenwright
Notation Part 2 Object Orientated Analysis and Design Benjamin Kenwright Outline Review What do we mean by Notation and UML? Types of UML View Continue UML Diagram Types Conclusion and Discussion Summary
More informationCLASSES AND OBJECTS IN JAVA
Lesson 8 CLASSES AND OBJECTS IN JAVA (1) Which of the following defines attributes and methods? (a) Class (b) Object (c) Function (d) Variable (2) Which of the following keyword is used to declare Class
More informationSEEM4570 System Design and Implementation Lecture 09 Object Oriented Programming
SEEM4570 System Design and Implementation Lecture 09 Object Oriented Programming Programming In general, there are two kinds of programming: Procedural Programming Also known as Imperative Programming
More informationCREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed
CREATED BY: Muhammad Bilal Arslan Ahmad Shaad JAVA Chapter No 5 Instructor: Muhammad Naveed Muhammad Bilal Arslan Ahmad Shaad Chapter No 5 Object Oriented Programming Q: Explain subclass and inheritance?
More informationSEEM4570 System Design and Implementation. Lecture 10 UML
SEEM4570 System Design and Implementation Lecture 10 UML Introduction In the previous lecture, we talked about software development life cycle in a conceptual level E.g. we need to write documents, diagrams,
More informationChapter 7. Inheritance
Chapter 7 Inheritance Introduction to Inheritance Inheritance is one of the main techniques of objectoriented programming (OOP) Using this technique, a very general form of a class is first defined and
More informationInheritance and Polymorphism
Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg
More informationContents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance
Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass
More informationChapter 5 Object-Oriented Programming
Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares
More informationWhat are the characteristics of Object Oriented programming language?
What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is
More information9/21/2010. Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh
Building Multitier Programs with Classes Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh The Object-Oriented Oriented (OOP) Development Approach Large production
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract Classes
More informationSEEM4570 System Design and Implementation Lecture 11 UML
SEEM4570 System Design and Implementation Lecture 11 UML Introduction In the previous lecture, we talked about software development life cycle in a conceptual level E.g. we need to write documents, diagrams,
More informationOOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.
OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
More informationDepartment of Computer science and Engineering Sub. Name: Object oriented programming and data structures Sub. Code: EC6301 Sem/Class: III/II-ECE Staff name: M.Kavipriya Two Mark Questions UNIT-1 1. List
More informationProgramming Language Concepts Object-Oriented Programming. Janyl Jumadinova 28 February, 2017
Programming Language Concepts Object-Oriented Programming Janyl Jumadinova 28 February, 2017 Three Properties of Object-Oriented Languages: Encapsulation Inheritance Dynamic method binding (polymorphism)
More informationPROGRAMMING LANGUAGE 2
31/10/2013 Ebtsam Abd elhakam 1 PROGRAMMING LANGUAGE 2 Java lecture (7) Inheritance 31/10/2013 Ebtsam Abd elhakam 2 Inheritance Inheritance is one of the cornerstones of object-oriented programming. It
More informationObject-Oriented Design
Object-Oriented Design Lecturer: Raman Ramsin Lecture 10: Analysis Packages 1 Analysis Workflow: Packages The analysis workflow consists of the following activities: Architectural analysis Analyze a use
More informationObject-Oriented Modeling Using UML. CS151 Chris Pollett Aug. 29, 2005.
Object-Oriented Modeling Using UML CS151 Chris Pollett Aug. 29, 2005. Outline Objects and Classes Modeling Relationships and Structures Some Terms and Concepts Objects and classes are fundamental to OO
More informationProgramming Exercise 14: Inheritance and Polymorphism
Programming Exercise 14: Inheritance and Polymorphism Purpose: Gain experience in extending a base class and overriding some of its methods. Background readings from textbook: Liang, Sections 11.1-11.5.
More informationExam Duration: 2hrs and 30min Software Design
Exam Duration: 2hrs and 30min. 433-254 Software Design Section A Multiple Choice (This sample paper has less questions than the exam paper The exam paper will have 25 Multiple Choice questions.) 1. Which
More informationData Structures (INE2011)
Data Structures (INE2011) Electronics and Communication Engineering Hanyang University Haewoon Nam ( hnam@hanyang.ac.kr ) Lecture 1 1 Data Structures Data? Songs in a smartphone Photos in a camera Files
More informationPractice for Chapter 11
Practice for Chapter 11 MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) Object-oriented programming allows you to derive new classes from existing
More informationObject oriented programming Concepts
Object oriented programming Concepts Naresh Proddaturi 09/10/2012 Naresh Proddaturi 1 Problems with Procedural language Data is accessible to all functions It views a program as a series of steps to be
More informationReview and Recursion
Midterm Exam Review Division of Mathematics and Computer Science Maryville College Outline Midterm Exam Review 1 Midterm Exam Review 2 Questions 1-10 Midterm Exam Review 1 What are some of the main challenges
More informationOVERRIDING. 7/11/2015 Budditha Hettige 82
OVERRIDING 7/11/2015 (budditha@yahoo.com) 82 What is Overriding Is a language feature Allows a subclass or child class to provide a specific implementation of a method that is already provided by one of
More informationObject Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming
Overview of OOP Object Oriented Programming is a programming method that combines: a) Data b) Instructions for processing that data into a self-sufficient object that can be used within a program or in
More informationInheritance, and Polymorphism.
Inheritance and Polymorphism by Yukong Zhang Object-oriented programming languages are the most widely used modern programming languages. They model programming based on objects which are very close to
More informationCS105 C++ Lecture 7. More on Classes, Inheritance
CS105 C++ Lecture 7 More on Classes, Inheritance " Operator Overloading Global vs Member Functions Difference: member functions already have this as an argument implicitly, global has to take another parameter.
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 17 Inheritance Overview Problem: Can we create bigger classes from smaller ones without having to repeat information? Subclasses: a class inherits
More informationObject Oriented Features. Inheritance. Inheritance. CS257 Computer Science I Kevin Sahr, PhD. Lecture 10: Inheritance
CS257 Computer Science I Kevin Sahr, PhD Lecture 10: Inheritance 1 Object Oriented Features For a programming language to be called object oriented it should support the following features: 1. objects:
More informationLecture Contents CS313D: ADVANCED PROGRAMMING LANGUAGE. What is Inheritance?
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 5: Inheritance & Polymorphism Lecture Contents 2 What is Inheritance? Super-class & sub class Protected members Creating subclasses
More informationLecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University
Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types
More informationOverview. OOP: model, map, reuse, extend. Examples of objects. Introduction to Object Oriented Design
Overview Introduction to Object Oriented Design Understand Classes and Objects. Understand some of the key concepts/features in the Object Oriented paradigm. Benefits of Object Oriented Design paradigm.
More informationJava Class Design. Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding
Java Class Design Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding eugeny.berkunsky@gmail.com http://www.berkut.mk.ua Objectives Implement encapsulation Implement inheritance
More informationROBOT OOP. Learning the basics of Object Oriented Programming using robots from popular culture
ROBOT OOP Learning the basics of Object Oriented Programming using robots from popular culture GOOD SOFTWARE Highly cohesive Loosely coupled IN THE BEGINNING Before OOP there was Procedural A procedure
More information7. Implementation Phase. 7.1 Architecture Diagrams 7.2 OO Languages: Java 7.3 Constraint Languages: OCL
7. Implementation Phase 7.1 Architecture Diagrams 7.2 OO Languages: Java 7.3 Constraint Languages: OCL Architecture Design Models An architecture model (structure model) is a model of a data processing
More informationObject-Oriented Design
Object-Oriented Design Lecturer: Raman Ramsin Lecture 9: Generalization/Specialization 1 Analysis Workflow: Analyze a Use Case The analysis workflow consists of the following activities: Architectural
More informationLecture Notes on Programming Languages
Lecture Notes on Programming Languages 85 Lecture 09: Support for Object-Oriented Programming This lecture discusses how programming languages support object-oriented programming. Topics to be covered
More informationAdvanced Programming Using Visual Basic 2008
Building Multitier Programs with Classes Advanced Programming Using Visual Basic 2008 The OOP Development Approach OOP = Object Oriented Programming Large production projects are created by teams Each
More informationINHERITANCE & POLYMORPHISM. INTRODUCTION IB DP Computer science Standard Level ICS3U. INTRODUCTION IB DP Computer science Standard Level ICS3U
C A N A D I A N I N T E R N A T I O N A L S C H O O L O F H O N G K O N G INHERITANCE & POLYMORPHISM P2 LESSON 12 P2 LESSON 12.1 INTRODUCTION inheritance: OOP allows a programmer to define new classes
More informationOverview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017
Overview of OOP Dr. Zhang COSC 1436 Summer, 2017 7/18/2017 Review Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in square brackets: l = [1, 2, "a"] (access by index, is mutable
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 5: Inheritance & Polymorphism Lecture Contents 2 What is Inheritance? Super-class & sub class Protected members Creating subclasses
More information(11-1) OOP: Inheritance in C++ D & D Chapter 11. Instructor - Andrew S. O Fallon CptS 122 (October 29, 2018) Washington State University
(11-1) OOP: Inheritance in C++ D & D Chapter 11 Instructor - Andrew S. O Fallon CptS 122 (October 29, 2018) Washington State University Key Concepts Base and derived classes Protected members Inheritance
More informationCGS 2405 Advanced Programming with C++ Course Justification
Course Justification This course is the second C++ computer programming course in the Computer Science Associate in Arts degree program. This course is required for an Associate in Arts Computer Science
More informationData Structures (list, dictionary, tuples, sets, strings)
Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access
More informationC++ Important Questions with Answers
1. Name the operators that cannot be overloaded. sizeof,.,.*,.->, ::,? 2. What is inheritance? Inheritance is property such that a parent (or super) class passes the characteristics of itself to children
More informationWEB APPLICATION ENGINEERING II
WEB APPLICATION ENGINEERING II Lecture #9 Umar Ibrahim Enesi Objectives Gain understanding of various constructs used in Object Oriented PHP. Understand the advantages of using OOP style over procedural
More informationObject Fundamentals. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/6448 Lecture 2 08/30/2007
Object Fundamentals Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/6448 Lecture 2 08/30/2007 1 Lecture Goals Introduce basic concepts, terminology, and notations for object-oriented analysis,
More informationObject-Oriented Analysis and Design Using UML
Object-Oriented Analysis and Design Using UML An Introduction to Unified Process and Design Patterns Mahesh P. Matha Object-Oriented Analysis and Design Using UML Object-Oriented Analysis and Design Using
More informationObject-oriented basics. Object Class vs object Inheritance Overloading Interface
Object-oriented basics Object Class vs object Inheritance Overloading Interface 1 The object concept Object Encapsulation abstraction Entity with state and behaviour state -> variables behaviour -> methods
More informationPaytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value
Paytm Programming Sample paper: 1) A copy constructor is called a. when an object is returned by value b. when an object is passed by value as an argument c. when compiler generates a temporary object
More informationIntroduction to OOP. Procedural Programming sequence of statements to solve a problem.
Introduction to OOP C++ - hybrid language improved and extended standard C (procedural language) by adding constructs and syntax for use as an object oriented language. Object-Oriented and Procedural Programming
More informationWhat is Inheritance?
Inheritance 1 Agenda What is and Why Inheritance? How to derive a sub-class? Object class Constructor calling chain super keyword Overriding methods (most important) Hiding methods Hiding fields Type casting
More informationIntro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a.
Intro to OOP - Object and class - The sequence to define and use a class in a program - How/when to use scope resolution operator - How/when to the dot operator - Should be able to write the prototype
More informationObject Fundamentals, Part One. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/5448 Lecture 2 08/27/2009
Object Fundamentals, Part One Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/5448 Lecture 2 08/27/2009 1 Lecture Goals Introduce basic concepts, terminology, and notations for object-oriented
More informationComputer Science 4U Unit 1. Programming Concepts and Skills Modular Design
Computer Science 4U Unit 1 Programming Concepts and Skills Modular Design Modular Design Reusable Code Object-oriented programming (OOP) is a programming style that represents the concept of "objects"
More informationAdvanced UML Class Models
Advanced UML Class Models Or: Love s Labors Lost Jonathan Sprinkle 1 University of Arizona Department of Electrical and Computer Engineering PO Box 210104, Tucson, AZ 85721, USA August 27, 2012 Jonathan
More informationWhat does it mean by information hiding? What are the advantages of it? {5 Marks}
SECTION ONE (COMPULSORY) Question #1 [30 Marks] a) Describe the main characteristics of object-oriented programming. {5 Marks Encapsulation the ability to define a new type and a set of operations on that
More informationCS304 Object Oriented Programming Final Term
1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes? Generalization (pg 29) Sub-typing
More informationProgramming, numerics and optimization
Programming, numerics and optimization Lecture A-4: Object-oriented programming Łukasz Jankowski ljank@ippt.pan.pl Institute of Fundamental Technological Research Room 4.32, Phone +22.8261281 ext. 428
More informationSubclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented
Table of Contents L01 - Introduction L02 - Strings Some Examples Reserved Characters Operations Immutability Equality Wrappers and Primitives Boxing/Unboxing Boxing Unboxing Formatting L03 - Input and
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 10 Creating Classes and Objects Objectives After studying this chapter, you should be able to: Define a class Instantiate an object from a class
More informationINHERITANCE: EXTENDING CLASSES
INHERITANCE: EXTENDING CLASSES INTRODUCTION TO CODE REUSE In Object Oriented Programming, code reuse is a central feature. In fact, we can reuse the code written in a class in another class by either of
More informationDay 3. COMP 1006/1406A Summer M. Jason Hinek Carleton University
Day 3 COMP 1006/1406A Summer 2016 M. Jason Hinek Carleton University today s agenda assignments 1 was due before class 2 is posted (be sure to read early!) a quick look back testing test cases for arrays
More informationInheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L
Inheritance Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 9.4 1 Inheritance Inheritance allows a software developer to derive
More informationObject-Oriented Design
Object-Oriented Design Lecture 14: Design Workflow Department of Computer Engineering Sharif University of Technology 1 UP iterations and workflow Workflows Requirements Analysis Phases Inception Elaboration
More informationdrawobject Circle draw
25 THE VISITOR PATTERN The Visitor pattern turns the tables on our object-oriented model and creates an external class to act on data in other classes. This is useful if there are a fair number of instances
More informationChapter 02 Building Multitier Programs with Classes
Chapter 02 Building Multitier Programs with Classes Student: 1. 5. A method in a derived class overrides a method in the base class with the same name. 2. 11. The Get procedure in a class module is used
More informationObject Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia
Object Oriented Programming in Java Jaanus Pöial, PhD Tallinn, Estonia Motivation for Object Oriented Programming Decrease complexity (use layers of abstraction, interfaces, modularity,...) Reuse existing
More informationChapter 5: Classes and Objects in Depth. Information Hiding
Chapter 5: Classes and Objects in Depth Information Hiding Objectives Information hiding principle Modifiers and the visibility UML representation of a class Methods Message passing principle Passing parameters
More informationA base class (superclass or parent class) defines some generic behavior. A derived class (subclass or child class) can extend the base class.
Inheritance A base class (superclass or parent class) defines some generic behavior. A derived class (subclass or child class) can extend the base class. A subclass inherits all of the functionality of
More informationOops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:
Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Abstraction Encapsulation Inheritance and Polymorphism Object-Oriented
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 12 Thomas Wies New York University Review Last lecture Modules Outline Classes Encapsulation and Inheritance Initialization and Finalization Dynamic
More informationCMPT 117: Tutorial 1. Craig Thompson. 12 January 2009
CMPT 117: Tutorial 1 Craig Thompson 12 January 2009 Administrivia Coding habits OOP Header Files Function Overloading Class info Tutorials Review of course material additional examples Q&A Labs Work on
More informationClasses and Inheritance Extending Classes, Chapter 5.2
Classes and Inheritance Extending Classes, Chapter 5.2 Dr. Yvon Feaster Inheritance Inheritance defines a relationship among classes. Key words often associated with inheritance are extend and implements.
More informationOOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.
OOPs Concepts 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. Type Casting Let us discuss them in detail: 1. Data Hiding: Every
More informationDarrell Bethea June 6, 2011
Darrell Bethea June 6, 2011 Program 4 due Friday Testing/debugging help online Final exam Comprehensive Monday, 6/13, 8-11 AM SN014 2 3 Inheritance 4 We have discussed before how classes of objects can
More informationClass Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.
Class Diagrams UML Class Diagram Classes consist of the class name written in BOLD features attributes and methods user-defined constraints Note that class diagrams contain only classes, not objects. Class
More informationObject Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year
Object Oriented Programming Assistant Lecture Omar Al Khayat 2 nd Year Syllabus Overview of C++ Program Principles of object oriented programming including classes Introduction to Object-Oriented Paradigm:Structures
More informationJAVA MOCK TEST JAVA MOCK TEST II
http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your
More informationPolymorphism 2/12/2018. Which statement is correct about overriding private methods in the super class?
Which statement is correct about overriding private methods in the super class? Peer Instruction Polymorphism Please select the single correct answer. A. Any derived class can override private methods
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 4&5: Inheritance Lecture Contents What is Inheritance? Super-class & sub class The object class Using extends keyword @override keyword
More informationSuper-Classes and sub-classes
Super-Classes and sub-classes Subclasses. Overriding Methods Subclass Constructors Inheritance Hierarchies Polymorphism Casting 1 Subclasses: Often you want to write a class that is a special case of an
More informationChapter 1: Object-Oriented Programming Using C++
Chapter 1: Object-Oriented Programming Using C++ Objectives Looking ahead in this chapter, we ll consider: Abstract Data Types Encapsulation Inheritance Pointers Polymorphism Data Structures and Algorithms
More informationAlgorithms and Programming
Algorithms and Programming Lecture 6 Classes, UML, NumPy Camelia Chira Course content Introduction in the software development process Procedural programming Modular programming Abstract data types Software
More informationObject-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018
Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 4: OO Principles - Polymorphism http://courses.cs.cornell.edu/cs2110/2018su Lecture 3 Recap 2 Good design principles.
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 20, 2014 Abstract
More informationMaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING SUB CODE / SUBJECT: CS1203 / Object oriented programming YEAR / SEM: II / III QUESTION BANK UNIT I FUNDAMENTALS PART-A (2 MARKS) 1. What is Object Oriented
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4(b): Inheritance & Polymorphism Lecture Contents What is Inheritance? Super-class & sub class The object class Using extends keyword
More informationLecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction
Lecture 13: Object orientation Object oriented programming Introduction, types of OO languages Key concepts: Encapsulation, Inheritance, Dynamic binding & polymorphism Other design issues Smalltalk OO
More informationC++ Inheritance and Encapsulation
C++ Inheritance and Encapsulation Private and Protected members Inheritance Type Public Inheritance Private Inheritance Protected Inheritance Special method inheritance 1 Private Members Private members
More informationClass Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.
Class Diagrams UML Class Diagram Classes consist of the class name written in BOLD features attributes and methods user defined constraints Note that class diagrams contain only classes, not objects. Class
More informationOBJECT ORIENTED PROGRAMMING
1. Programming Paradigms OBJECT ORIENTED PROGRAMMING A programming methodology defines the methodology of designing and implementing programs using the key features and other building blocks (such as key
More informationC++ (Non for C Programmer) (BT307) 40 Hours
C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular
More informationCS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE
CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE PART A UNIT I 1. Differentiate object oriented programming from procedure oriented programming. 2. Define abstraction and encapsulation. 3. Differentiate
More informationCOP 3330 Final Exam Review
COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time
More informationIntroduction to Object- Oriented Programming
Introduction to Object- Oriented Programming Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_us
More informationFinal Examination Semester 3 / Year 2010
Southern College Kolej Selatan 南方学院 Final Examination Semester 3 / Year 2010 COURSE : OBJECT-ORIENTED PROGRAMMING COURSE CODE : PROG 2013 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM
More information