Abstract Classes Interfaces

Size: px
Start display at page:

Download "Abstract Classes Interfaces"

Transcription

1 Abstract Classes Interfaces Reading: Chapter 14 (skip 14.1,14.6, 14.12, and 14.13; read 14.7 lightly) Objectives 2 To design and use abstract classes ( ). To specify common behavior for objects using interfaces ( 14.4). 4) To define a natural order using the Comparable interface ( 14.5). To understand the Cloneable interface ( 14.7). To explore the similarities and differences between an abstract class and an interface ( 14.8). To create objects for primitive values using the wrapper classes (Byte, Short, Integer, Long, Float, Double, Character, and Boolean) ( 14.9). To simplify programming using automatic conversion between primitive types and wrapper class types ( 14.11) 1

2 Abstract Classes Superclasses in a class hierarchy are very general Some are so general, they cannot be implemented package liang.chapter14; public abstract class GeometricObject { private String color = "white"; private boolean filled; private java.util.date datecreated; 3 protected GeometricObject() { datecreated = new java.util.date(); protected GeometricObject(String color, boolean filled) { datecreated = new java.util.date(); this.color = color; this.filled = filled;... Example From Textbook GeometricObject defines all categories of geometry In UML, italics GrometricObject indicate abstract color: String filled: Boolean datecreated: java.util.date radius: double Circle Rectangle width: double height: double 4 In UML, Superclass properties are not shown in subclasses 2

3 GeometricObject Methods Methods that cannot be implemented are abstract public String getcolor() {return color; public void setcolor(string color) {this.color = color; public boolean isfilled() {return filled; public void setfilled(boolean filled) {this.filled = filled; public java.util.date getdatecreated() {return datecreated; public String tostring() { return "created on " + datecreated + "\ncolor: " + color + " and filled: " + filled; public abstract double getarea(); public abstract double getperimeter(); The methods of GeometricObject are generic to any geometric object (e.g., circle) 5 Rules for Abstract Methods If a subclass of an abstract superclass does not implement all the abstract methods, the subclass must be defined abstract bt t The rule above means that in a non-abstract subclass extended from an abstract class, all the abstract methods must be implemented, even if they are not used in the subclass. An abstract t class cannot be instantiated ti t using the new operator, but you can still define its constructors, which are invoked in the constructors of its subclasses 6 3

4 Constructing an Object Remember, a constructor will automatically call the constructor of the superclass if you do not public abstract class GeometricObject { private String color = "white"; private boolean filled; private java.util.date datecreated; protected GeometricObject() { datecreated = new java.util.date();... public Rectangle() { calls to GeometricObject() public Rectangle(double width, double height) { this.width = width; this.height = height; 7 Superclass of Abstract Class A subclass can be abstract even if its superclass is concrete For example the Object class is concrete, but its subclasses, such as GeometricObject, may be abstract 8 4

5 Abstract Class as Type You cannot create an instance from an abstract class using the new operator, but an abstract class can be used as a dt data type Therefore, the following statement, which creates an array whose elements are of GeometricObject type, is correct GeometricObject[] geo = new GeometricObject[10]; Why is this correct? Doesn t new instantiate an object? 9 9 Why Abstract Methods? Example GeometricObject geoobject1 = new Circle(5); GeometricObject geoobject2 = new Rectangle(5, 3); System.out.println( Objects have the same area? " + equalarea(geoobject1, geoobject2));... public static boolean equalarea( GeometricObject ob1, GeometricObject ob2) { return ob1.getarea() == ob2.getarea(); getarea method is defined in GeometricObject, but the implementation of the actual object is used 10 5

6 Calendar Class Constants Calendar class contains many constants that make code easier to read and write Remember constants are static and by convention coded in caps 11 enum is a better way to implement related constants, but you will not cover than until CSE219 The get Method in Calendar Class The get(int field) method defined in the Calendar class is useful to extract date and time information from a Calendar object you provide the field, get returns the value of that field The fields are defined as constants, as shown in the following Constant Description 12 YEAR MONTH DATE HOUR HOUR_OF_DAY MINUTE SECOND DAY_OF_WEEK DAY_OF_MONTH DAY_OF_YEAR WEEK_OF_MONTH WEEK_OF_YEAR AM_PM The year of the calendar. The month of the calendar with 0 for January. The day of the calendar. The hour of the calendar (12-hour notation). The hour of the calendar (24-hour notation). The minute of the calendar. The second of the calendar. The day number within the week with 1 for Sunday. Same as DATE. The day number in the year with 1 for the first day of the year. The week number within the month. The week number within the year. Indicator for AM or PM (0 for AM and 1 for PM). 6

7 Java Library Example The italic font show that Calendar is abstract java.util.calendar #Calendar() +get(field: int): int +set(field: int, value: int): void Constructs a default calendar. Returns the value of the given calendar field. Sets the given calendar to the specified ed value. +set(year: int, month: int, Sets the calendar with the specified year, month, and date. The month dayofmonth: int): void parameter is 0-based, that is, 0 is for January. +getactualmaximum(field: int): int Returns the maximum value that the specified calendar field could have. +add(field: int, amount: int): void Adds or subtracts the specified amount of time to the given calendar field. +gettime(): java.util.date Returns a Date object representing this calendar s time value (million second offset from the Unix epoch). +settime(date: java.util.date): void Sets this calendar s time with the given Date object. Calendar for extraction of calendar data java.util.gregoriancalendar +GregorianCalendar() Constructs a GregorianCalendar for the current time. +GregorianCalendar(year: int, month: int, dayofmonth: int) +GregorianCalendar(year: int, month: int, dayofmonth: int, hour:int, minute: int, second: int) Constructs a GregorianCalendar for the specified year, month, and day of month. Constructs a GregorianCalendar for the specified year, month, day of month, hour, minute, and second. The month parameter is 0-based, that is, 0 is for January. 13 The GregorianCalendar Class You can use new GregorianCalendar() to construct a default GregorianCalendar with the current time and new GregorianCalendar(year, month, date) to construct a GregorianCalendar with the specified year, month, and date The month parameter is 0-based, i.e., 0 is for January. An enum based calendar does not require you to remember the 0=january convention 14 7

8 What is an Interface? 15 An interface is a class-like construct that contains only constants and abstract methods An interface is similar il to an abstract t class, but the intent t of an interface is to specify behavior for objects For example, you can specify that the objects are Comparable Edible Cloneable Each of these is defined with an interface Comparable c; If you have instantiated an object that implements an interface, you can declare it as the type of the interface Define an Interface To distinguish an interface from a class, Java uses the following syntax to define an interface: public interface InterfaceName { constant declarations; method signatures; Interface inheritance and class inheritance are the same Example public interface Edible { /** Describe how to eat */ public abstract String howtoeat(); 16 8

9 Interface is a Special Class An interface is treated like a special class in Java Each interface is compiled into a separate bytecode file, just like a regular class You cannot create an instance from an interface using the new operator In most cases you can use an interface more or less the same way you use an abstract class 17 Omitting Modifiers in Interfaces All Interface data fields are public final static All Interface methods are public abstract You can omit the modifiers public interface T1 { public static final int K = 1; Equivalent public interface T1 { int K = 1; public abstract void p(); void p(); A constant defined in an interface can be accessed using syntax InterfaceName.CONSTANT_NAME (e.g., T1.K). 18 9

10 Example: The Comparable Interface If you need to compare objects,, you can define comparison rules with the Comparable interface Used with Java library sorting routines package java.lang; Note that the Java API documents a generic compareto method public interface Comparable { public int compareto(object o); compareto returns Negative integer this object is less than o Zero this object is equal to o Positive integer this object is greater than o 19 String and Date Classes Many classes (e.g., String and Date) in the Java library implement Comparable to define a natural order for the objects In the source code of these classes,,you will see the keyword implements public class String extends Object implements Comparable { // class body omitted public class Date extends Object implements Comparable { // class body omitted new String() instanceof String All these expressions new String() instanceof Comparable evaluate to true new java.util.date() instanceof java.util.date new java.util.date() instanceof Comparable 20 10

11 Generic max Method The return value from the max method is of type Comparable You need to cast it to String or Date explicitly String s1 = "abcdef"; String s2 = "abcdee"; String s3 = (String)Max.max(s1, s2); Date d1 = new Date(); Date d2 = new Date(); Date d3 = (Date)Max.max(d1, d2); (a) and (b) are 2 approaches for a max method (a is better) // Max.java: Find a maximum object public class Max { /** Return the maximum of two objects */ public static Comparable max (Comparable o1, Comparable o2) { if (o1.compareto(o2) > 0) return o1; else return o2; // Max.java: Find a maximum object public class Max { /** Return the maximum of two objects */ public static Object max (Object o1, Object o2) { if (((Comparable)o1).compareTo(o2) > 0) return o1; else return o2; 21 (a) (b) The Cloneable Interface Useful when you need to make a copy of an object 22 package java.lang; public interface Cloneable { Notice that the Cloneable interface in the Java library is empty why? An interface with an empty body is a marker interface Associates metadata with a class Clone method of the Object class checks whether the object is cloneable Based on Java non-support of metadata but now we have Java annotations 11

12 Examples Many classes (e.g., Date and Calendar) in the Java library implement Cloneable (by convention they override the Object clone method) Example Calendar calendar = new GregorianCalendar(2003, 2, 1); Calendar calendarcopy = (Calendar)calendar.clone(); System.out.println("calendar == calendarcopy is " + (calendar == calendarcopy)); System.out.println("calendar.equals(calendarCopy) is " + calendar.equals(calendarcopy)); equals(calendarcopy)); How does this compare to calendarcopy=calendar; displays calendar == calendarcopy; is false calendar.equals(calendarcopy); is true 23 Interfaces vs. Abstract Classes In an interface, the data must be constants; an abstract class can have all types of data. Each method in an interface has only a signature without implementation; an abstract class can have concrete methods. Variables Constructors Methods Abstract class Interface No restrictions Constructors are invoked by subclasses through constructor chaining An abstract class cannot be instantiated using the new operator All variables must be public static final No constructors An interface cannot be instantiated using the new operator No restrictions. All methods must be public abstract instance methods 24 12

13 Interfaces vs. Abstract Classes All classes share a single root, the Object class, but there is no single root for interfaces If a class extends an interface, this interface plays the same role as a superclass Interface1_2 Interface2_2 Interface1_1 Interface1 Interface2_1 Object Class1 Class2 25 Caution: Conflict Interfaces In rare occasions, a class may implement two interfaces with conflict information (e.g., two same constants with different values or two methods with same signature but different return type) This type of errors will be detected by the compiler

14 Interface or Class? Abstract classes and interfaces can both be used to model common features - how do you decide whether to use an interface or a class? In general, a strong is-a relationship that clearly describes a parent-child relationship should be modeled using classes (e.g., a staff member is a person, therefore use class inheritance) A weak is-a relationship, also known as an is-kind-of relationship, indicates that an object possesses a certain property and can be modeled using interfaces (e.g., g, all strings are comparable, so the String class implements the Comparable interface) In the case of multiple inheritance, you have to design one as a superclass, and others as interface 27 Wrapper Classes Boolean Character Short Byte Integer Long Float Double The wrapper classes do not have no-arg constructors java.lang.comparable The instances of all wrapper classes are immutable, i.e., their internal values cannot be changed once the objects are created Wrapper classes are useful when you need to treat a primitive as an object (e.g., in a Map) java.lang.object Number Character Boolean Double Float Long Integer Short Byte 28 14

15 Wrapper Classes Note the UML notation for interfaces (dashed line) java.lang.comparable java.lang.object Number Character Boolean Double Float Long Integer Short Byte The Number abstract class defines abstract methods for intvalue, shortvalue, floatvalue, etc. 29 Wrapper Class Methods Each wrapper class overrides the tostring and equals methods defined in the Object class Since all the numeric wrapper classes and the Character class implement the Comparable interface, the compareto method is implemented in these classes 30 15

16 The Integer and Double Classes java.lang.number +bytevalue(): byte +shortvalue(): short +intvalue(): int -valu e: in t +MAX_VALUE: int +MIN_VALUE: int java.lang.integer +longvalue(): V l long +Int eger(val ue: i nt) +floatvalue(): float +Int eger(s: String) +doublevalue():double +valueof(s: String): Integer +valueof(s: String, radix: int): Integer +parseint(s: String): int java.lang.comparable +parseint(s: String, radix: int): int +compareto(o: Object): int java.lang.double -value: doub le +MAX_VALUE: double +MIN_VALUE: double 31 +Dou ble(value: double) +Dou ble(s: String) +valueof(s: String): Double +valu eof(s: String, radix: int): Double +parsedouble(s: String): double +parsedouble (s: String, radix: int): double Numeric Wrapper Class Constructors You can construct a wrapper object either from a primitive data type value or from a string representing the numeric value The constructors for Integer and Double are: public Integer(int value) public Integer(String s) public Double(double value) public Double(String s) 32 16

17 Numeric Wrapper Class Constants Each numerical wrapper class has the constants MAX_VALUE and MIN_VALUE. MAX_VALUE represents the maximum value of the corresponding primitive data type For Byte, Short, Integer, and Long, MIN_VALUE represents the minimum byte, short, int, and long values For Float and Double, MIN_VALUE represents the minimum positive float and double values 33 The Static valueof Methods Wrapper method valueof(string s) creates a new object initialized to the value represented by the specified string Example: Double doubleobject = Double.valueOf("12.4"); Integer integerobject = Integer.valueOf("12"); Convenience method that returns new Integer(Integer.parseInt(s)) 34 17

18 Parsing Strings into Numbers You have used the parseint method in the Integer class to parse a numeric string into an int value and the parsedouble method in the Double class to parse a numeric string into a double value Each numeric wrapper class has two overloaded dd parsing methods to parse a numeric string into an appropriate numeric value 35 Tip Java provides a static sort method for sorting an array of Object in the java.util.arrays class You can use the following code to sort arrays in this example: java.util.arrays.sort(intarray); java.util.arrays.sort(doublearray); java.util.arrays.sort(chararray); java.util.arrays.sort(stringarray); 36 18

19 Note Arrays are objects An array is an instance of the Object class. Furthermore, if A is a subclass of B, every instance of A[] is an instance of B[]. Therefore, the following statements are all true: new int[10] instanceof Object new GregorianCalendar[10] instanceof Calendar[]; new Calendar[10] instanceof Object[] new Calendar[10] instanceof Object 37 Automatic Conversion JDK 1.5 allows primitive type and wrapper classes to be converted automatically Example, the following statement in (a) can be simplified as in (b): Integer[] intarray = {new Integer(2), new Integer(4), new Integer(3); Equivalen t Integer[] intarray = {2, 4, 3; (a) New JDK 1.5 boxing (b) Integer[] intarray = {1, 2, 3; System.out.println(intArray[0] + intarray[1] + intarray[2]); 38 Unboxing 19

20 Did you Satisfy the Objectives 39 To design and use abstract classes ( ). To specify common behavior for objects using interfaces ( 14.4). 4) To define a natural order using the Comparable interface ( 14.5). To understand the Cloneable interface ( 14.7). To explore the similarities and differences between an abstract class and an interface ( 14.8). To create objects for primitive values using the wrapper classes (Byte, Short, Integer, Long, Float, Double, Character, and Boolean) ( 14.9). To simplify programming using automatic conversion between primitive types and wrapper class types ( 14.11) 20

Chapter 9 Abstract Classes and Interfaces

Chapter 9 Abstract Classes and Interfaces Chapter 9 Abstract Classes and Interfaces Prerequisites for Part II Chapter 5 Arrays Chapter 6 Objects and Classes Chapter 7 Strings Chapter 8 Inheritance and Polymorphism You can cover GUI after Chapter

More information

Chapter 11 Object-Oriented Design Exception and binary I/O can be covered after Chapter 9

Chapter 11 Object-Oriented Design Exception and binary I/O can be covered after Chapter 9 Chapter 6 Arrays Chapter 8 Strings Chapter 7 Objects and Classes Chapter 9 Inheritance and Polymorphism GUI can be covered after 10.2, Abstract Classes Chapter 12 GUI Basics 10.2, Abstract Classes Chapter

More information

Lecture Notes Chapter #9_c Abstract Classes & Interfaces

Lecture Notes Chapter #9_c Abstract Classes & Interfaces Lecture Notes Chapter #9_c Abstract Classes & Interfaces Abstract Classes parent class child class more abstract more concrete, i.e., less abstract abstract class o class with an abstract modifier o class

More information

Chapter 13 Abstract Classes and Interfaces

Chapter 13 Abstract Classes and Interfaces Chapter 13 Abstract Classes and Interfaces rights reserved. 1 Motivations You have learned how to write simple programs to create and display GUI components. Can you write the code to respond to user actions,

More information

Motivations. Objectives. object cannot be created from abstract class. abstract method in abstract class

Motivations. Objectives. object cannot be created from abstract class. abstract method in abstract class Motivations Chapter 13 Abstract Classes and Interfaces You have learned how to write simple programs to create and display GUI components. Can you write the code to respond to user actions, such as clicking

More information

Chapter 13 Abstract Classes and Interfaces. Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited

Chapter 13 Abstract Classes and Interfaces. Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited Chapter 13 Abstract Classes and Interfaces Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited 2015 1 Motivations You have learned how to write simple programs

More information

CS 112 Programming 2. Lecture 10. Abstract Classes & Interfaces (1) Chapter 13 Abstract Classes and Interfaces

CS 112 Programming 2. Lecture 10. Abstract Classes & Interfaces (1) Chapter 13 Abstract Classes and Interfaces CS 112 Programming 2 Lecture 10 Abstract Classes & Interfaces (1) Chapter 13 Abstract Classes and Interfaces 2 1 Motivations We have learned how to write simple programs to create and display GUI components.

More information

Chapter 13 Abstract Classes and Interfaces

Chapter 13 Abstract Classes and Interfaces Chapter 13 Abstract Classes and Interfaces 1 Abstract Classes Abstraction is to extract common behaviors/properties into a higher level in the class hierarch so that they are shared (implemented) by subclasses

More information

We are on the GUI fast track path

We are on the GUI fast track path We are on the GUI fast track path Chapter 13: Exception Handling Skip for now Chapter 14: Abstract Classes and Interfaces Sections 1 9: ActionListener interface Chapter 15: Graphics Skip for now Chapter

More information

Chapter 14 Abstract Classes and Interfaces

Chapter 14 Abstract Classes and Interfaces Chapter 14 Abstract Classes and Interfaces 1 What is abstract class? Abstract class is just like other class, but it marks with abstract keyword. In abstract class, methods that we want to be overridden

More information

Motivations. Chapter 13 Abstract Classes and Interfaces

Motivations. Chapter 13 Abstract Classes and Interfaces Chapter 13 Abstract Classes and Interfaces CS1: Java Programming Colorado State University Original slides by Daniel Liang Modified slides by Chris Wilcox Motivations You have learned how to write simple

More information

Abstract Classes and Interfaces. CSE 114, Computer Science 1 Stony Brook University

Abstract Classes and Interfaces. CSE 114, Computer Science 1 Stony Brook University Abstract Classes and Interfaces CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 Abstract Classes and Abstract Methods The # sign indicates protected modifier Abstract

More information

Chapter 13 Abstract Classes and Interfaces

Chapter 13 Abstract Classes and Interfaces Chapter 13 Abstract Classes and Interfaces rights reserved. 1 Motivations You have learned how to write simple programs to create and display GUI components. Can you write the code to respond to user actions,

More information

ITI Introduction to Computing II

ITI 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 21, 2013 Abstract

More information

ITI Introduction to Computing II

ITI 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 information

25. Interfaces. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

25. Interfaces. Java. Summer 2008 Instructor: Dr. Masoud Yaghini 25. Interfaces Java Summer 2008 Instructor: Dr. Masoud Yaghini Outline Definition The Comparable Interface Interfaces vs. Abstract Classes Creating Custom Interfaces References Definition Definition Sometimes

More information

Chapter 10 Inheritance and Polymorphism. Dr. Hikmat Jaber

Chapter 10 Inheritance and Polymorphism. Dr. Hikmat Jaber Chapter 10 Inheritance and Polymorphism Dr. Hikmat Jaber 1 Motivations Suppose you will define classes to model circles, rectangles, and triangles. These classes have many common features. What is the

More information

Abstract Class. Lecture 21. Based on Slides of Dr. Norazah Yusof

Abstract Class. Lecture 21. Based on Slides of Dr. Norazah Yusof Abstract Class Lecture 21 Based on Slides of Dr. Norazah Yusof 1 Abstract Class Abstract class is a class with one or more abstract methods. The abstract method Method signature without implementation

More information

Chapter 10. Object-Oriented Thinking

Chapter 10. Object-Oriented Thinking Chapter 10 Object-Oriented Thinking 1 Class Abstraction and Encapsulation Class abstraction is the separation of class implementation details from the use of the class. The class creator provides a description

More information

C20a: Selected Interfaces in Java API

C20a: Selected Interfaces in Java API CISC 3115 TY3 C20a: Selected Interfaces in Java API Hui Chen Department of Computer & Information Science CUNY Brooklyn College 10/30/2018 CUNY Brooklyn College 1 Outline Discussed Recap Inheritance and

More information

26. Interfaces. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

26. Interfaces. Java. Fall 2009 Instructor: Dr. Masoud Yaghini 26. Interfaces Java Fall 2009 Instructor: Dr. Masoud Yaghini Outline Definition The Comparable Interface Interfaces vs. Abstract Classes Creating Custom Interfaces References Definition Definition Single

More information

Chapter 21- Using Generics Case Study: Geometric Bunch. Class: Driver. package csu.matos; import java.util.arraylist; public class Driver {

Chapter 21- Using Generics Case Study: Geometric Bunch. Class: Driver. package csu.matos; import java.util.arraylist; public class Driver { Chapter 21- Using Generics Case Study: Geometric Bunch In this example a class called GeometricBunch is made to wrap around a list of GeometricObjects. Circle and Rectangle are subclasses of GeometricObject.

More information

CS171:Introduction to Computer Science II. Li Xiong

CS171:Introduction to Computer Science II. Li Xiong CS171:Introduction to Computer Science II Simple Sorting (cont.) + Interface Li Xiong Today Simple sorting algorithms (cont.) Bubble sort Selection sort Insertion sort Interface Sorting problem Two useful

More information

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017 Introduction to OOP with Java Instructor: AbuKhleif, Mohammad Noor Sep 2017 Lecture 11: Inheritance and Polymorphism Part 1 Instructor: AbuKhleif, Mohammad Noor Sep 2017 Instructor AbuKhleif, Mohammad

More information

C08c: A Few Classes in the Java Library (II)

C08c: A Few Classes in the Java Library (II) CISC 3115 TY3 C08c: A Few Classes in the Java Library (II) Hui Chen Department of Computer & Information Science CUNY Brooklyn College 9/20/2018 CUNY Brooklyn College 1 Outline Discussed Concepts of two

More information

Lecture Notes Chapter #9_b Inheritance & Polymorphism

Lecture Notes Chapter #9_b Inheritance & Polymorphism Lecture Notes Chapter #9_b Inheritance & Polymorphism Inheritance results from deriving new classes from existing classes Root Class all java classes are derived from the java.lang.object class GeometricObject1

More information

PIC 20A Number, Autoboxing, and Unboxing

PIC 20A Number, Autoboxing, and Unboxing PIC 20A Number, Autoboxing, and Unboxing Ernest Ryu UCLA Mathematics Last edited: October 27, 2017 Illustrative example Consider the function that can take in any object. public static void printclassandobj

More information

Inheritance and Polymorphism. CSE 114, Computer Science 1 Stony Brook University

Inheritance and Polymorphism. CSE 114, Computer Science 1 Stony Brook University Inheritance and Polymorphism CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Motivation Model classes with similar properties and methods: Circles, rectangles

More information

CS1150 Principles of Computer Science Objects and Classes

CS1150 Principles of Computer Science Objects and Classes CS1150 Principles of Computer Science Objects and Classes Yanyan Zhuang Department of Computer Science http://www.cs.uccs.edu/~yzhuang CS1150 UC. Colorado Springs Object-Oriented Thinking Chapters 1-8

More information

Chapter 11 Inheritance and Polymorphism. Motivations. Suppose you will define classes to model circles,

Chapter 11 Inheritance and Polymorphism. Motivations. Suppose you will define classes to model circles, Chapter 11 Inheritance and Polymorphism 1 Motivations Suppose you will define classes to model circles, rectangles, and triangles. These classes have many common features. What is the best way to design

More information

Inheritance and Polymorphism

Inheritance and Polymorphism Inheritance and Polymorphism Dr. M. G. Abbas Malik Assistant Professor Faculty of Computing and IT (North Jeddah Branch) King Abdulaziz University, Jeddah, KSA mgmalik@kau.edu.sa www.sanlp.org/malik/cpit305/ap.html

More information

Object Oriented System Development Paradigm. Sunnie Chung CIS433 System Analysis Methods

Object Oriented System Development Paradigm. Sunnie Chung CIS433 System Analysis Methods Object Oriented System Development Paradigm Sunnie Chung CIS433 System Analysis Methods OO Programming Concepts Object-oriented programming (OOP) involves programming using objects. An object represents

More information

22. Inheritance. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

22. Inheritance. Java. Summer 2008 Instructor: Dr. Masoud Yaghini 22. Inheritance Java Summer 2008 Instructor: Dr. Masoud Yaghini Outline Superclasses and Subclasses Using the super Keyword Overriding Methods The Object Class References Inheritance Object-oriented programming

More information

24. Inheritance. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

24. Inheritance. Java. Fall 2009 Instructor: Dr. Masoud Yaghini 24. Inheritance Java Fall 2009 Instructor: Dr. Masoud Yaghini Outline Superclasses and Subclasses Using the super Keyword Overriding Methods The Object Class References Superclasses and Subclasses Inheritance

More information

COMP200 INHERITANCE. OOP using Java, from slides by Shayan Javed

COMP200 INHERITANCE. OOP using Java, from slides by Shayan Javed 1 1 COMP200 INHERITANCE OOP using Java, from slides by Shayan Javed 2 Inheritance Derive new classes (subclass) from existing ones (superclass). Only the Object class (java.lang) has no superclass Every

More information

CISC 3115 TY3. C09a: Inheritance. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 9/20/2018 CUNY Brooklyn College

CISC 3115 TY3. C09a: Inheritance. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 9/20/2018 CUNY Brooklyn College CISC 3115 TY3 C09a: Inheritance Hui Chen Department of Computer & Information Science CUNY Brooklyn College 9/20/2018 CUNY Brooklyn College 1 Outline Inheritance Superclass/supertype, subclass/subtype

More information

JAVA WRAPPER CLASSES

JAVA WRAPPER CLASSES JAVA WRAPPER CLASSES Description Each of Java's eight primitive data types has a class dedicated to it. These are known as wrapper classes, because they "wrap" the primitive data type into an object of

More information

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Contents. 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 information

Lesson:9 Working with Array and String

Lesson:9 Working with Array and String Introduction to Array: Lesson:9 Working with Array and String An Array is a variable representing a collection of homogeneous type of elements. Arrays are useful to represent vector, matrix and other multi-dimensional

More information

Constructor. Liang, Introduction to Java Programming, Tenth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.

Constructor. Liang, Introduction to Java Programming, Tenth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. Constructor Suppose you will define classes to model circles, rectangles, and triangles. These classes have many common features. What is the best way to design these classes so to avoid redundancy? The

More information

IST311. Advanced Issues in OOP: Inheritance and Polymorphism

IST311. Advanced Issues in OOP: Inheritance and Polymorphism IST311 Advanced Issues in OOP: Inheritance and Polymorphism IST311/602 Cleveland State University Prof. Victor Matos Adapted from: Introduction to Java Programming: Comprehensive Version, Eighth Edition

More information

CS-202 Introduction to Object Oriented Programming

CS-202 Introduction to Object Oriented Programming CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture III Inheritance and Polymorphism Introduction to Inheritance Introduction

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Chapter 10 Thinking in Objects. Liang, Introduction to Java Programming, Eleventh Edition, (c) 2018 Pearson Education, Ltd. All rights reserved.

Chapter 10 Thinking in Objects. Liang, Introduction to Java Programming, Eleventh Edition, (c) 2018 Pearson Education, Ltd. All rights reserved. Chapter 10 Thinking in Objects 1 Motivations You see the advantages of object-oriented programming from the preceding chapter. This chapter will demonstrate how to solve problems using the object-oriented

More information

Chapter 10 Thinking in Objects. Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited

Chapter 10 Thinking in Objects. Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited Chapter 10 Thinking in Objects Liang, Introduction to Java Programming, Tenth Edition, Global Edition. Pearson Education Limited 2015 1 Motivations You see the advantages of object-oriented programming

More information

In this lab, you will be given the implementation of the classes GeometricObject, Circle, and Rectangle, as shown in the following UML class diagram.

In this lab, you will be given the implementation of the classes GeometricObject, Circle, and Rectangle, as shown in the following UML class diagram. Jordan University Faculty of Engineering and Technology Department of Computer Engineering Object-Oriented Problem Solving: CPE 342 Lab-8 Eng. Asma Abdel Karim In this lab, you will be given the implementation

More information

What is an interface? Why is an interface useful?

What is an interface? Why is an interface useful? IST311 Interfaces IST311 / 602 Cleveland State University Prof. Victor Matos Adapted from: Introduction to Java Programming: Comprehensive Version, Eighth Edition by Y. Daniel Liang 1 What is an interface?

More information

Inheritance (continued) Inheritance

Inheritance (continued) Inheritance Objectives Chapter 11 Inheritance and Polymorphism Learn about inheritance Learn about subclasses and superclasses Explore how to override the methods of a superclass Examine how constructors of superclasses

More information

JAVA.LANG.INTEGER CLASS

JAVA.LANG.INTEGER CLASS JAVA.LANG.INTEGER CLASS http://www.tutorialspoint.com/java/lang/java_lang_integer.htm Copyright tutorialspoint.com Introduction The java.lang.integer class wraps a value of the primitive type int in an

More information

Index COPYRIGHTED MATERIAL

Index COPYRIGHTED MATERIAL Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

CS 112 Programming 2. Lecture 06. Inheritance & Polymorphism (1) Chapter 11 Inheritance and Polymorphism

CS 112 Programming 2. Lecture 06. Inheritance & Polymorphism (1) Chapter 11 Inheritance and Polymorphism CS 112 Programming 2 Lecture 06 Inheritance & Polymorphism (1) Chapter 11 Inheritance and Polymorphism rights reserved. 2 Motivation Suppose you want to define classes to model circles, rectangles, and

More information

For this section, we will implement a class with only non-static features, that represents a rectangle

For this section, we will implement a class with only non-static features, that represents a rectangle For this section, we will implement a class with only non-static features, that represents a rectangle 2 As in the last lecture, the class declaration starts by specifying the class name public class Rectangle

More information

COMP200 ABSTRACT CLASSES. OOP using Java, from slides by Shayan Javed

COMP200 ABSTRACT CLASSES. OOP using Java, from slides by Shayan Javed 1 1 COMP200 ABSTRACT CLASSES OOP using Java, from slides by Shayan Javed Abstract Classes 2 3 From the previous lecture: public class GeometricObject { protected String Color; protected String name; protected

More information

COP 3330 Final Exam Review

COP 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 information

CSE 143 Lecture 20. Circle

CSE 143 Lecture 20. Circle CSE 143 Lecture 20 Abstract classes Circle public class Circle { private double radius; public Circle(double radius) { this.radius = radius; public double area() { return Math.PI * radius * radius; public

More information

Introduction to Java Programming Comprehensive Version

Introduction to Java Programming Comprehensive Version GLOBAL EDITION Introduction to Java Programming Comprehensive Version TENTH EDITION Y. Daniel Liang To Samantha, Michael, and Michelle Editorial Director, ECS: Marcia Horton Head of Learning Assets Acquisition,

More information

Introduction to Inheritance

Introduction to Inheritance Introduction to Inheritance James Brucker These slides cover only the basics of inheritance. What is Inheritance? One class incorporates all the attributes and behavior from another class -- it inherits

More information

Computer Science II (20073) Week 1: Review and Inheritance

Computer Science II (20073) Week 1: Review and Inheritance Computer Science II 4003-232-01 (20073) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Hardware and Software Hardware Physical devices in a computer system

More information

CSC Java Programming, Fall Java Data Types and Control Constructs

CSC Java Programming, Fall Java Data Types and Control Constructs CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference

More information

Inheritance. 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 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 information

Chapter 11 Inheritance and Polymorphism

Chapter 11 Inheritance and Polymorphism Chapter 11 Inheritance and Polymorphism Lecture notes for computer programming 1 Faculty of Engineering and Information Technology Prepared by: Iyad Albayouk 1 Motivations Suppose you will define classes

More information

Inheritance, Polymorphism, and Interfaces

Inheritance, Polymorphism, and Interfaces Inheritance, Polymorphism, and Interfaces Chapter 8 Inheritance Basics (ch.8 idea) Inheritance allows programmer to define a general superclass with certain properties (methods, fields/member variables)

More information

Chapter 11 Inheritance and Polymorphism

Chapter 11 Inheritance and Polymorphism Chapter 11 Inheritance and Polymorphism 1 Motivations OOP is built on three principles: Encapsulation (classes/objects, discussed in chapters 9 and 10), Inheritance, and Polymorphism. Inheritance: Suppose

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

CS/ENGRD 2110 SPRING Lecture 7: Interfaces and Abstract Classes

CS/ENGRD 2110 SPRING Lecture 7: Interfaces and Abstract Classes CS/ENGRD 2110 SPRING 2019 Lecture 7: Interfaces and Abstract Classes http://courses.cs.cornell.edu/cs2110 1 Announcements 2 A2 is due Thursday night (14 February) Go back to Lecture 6 & discuss method

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write

More information

INHERITANCE & POLYMORPHISM. INTRODUCTION IB DP Computer science Standard Level ICS3U. INTRODUCTION IB DP Computer science Standard Level ICS3U

INHERITANCE & 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 information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

More information

Chapter 11 Object-Oriented Design Exception and binary I/O can be covered after Chapter 9

Chapter 11 Object-Oriented Design Exception and binary I/O can be covered after Chapter 9 Chapter 6 Arrays Chapter 7 Objects and Classes Chapter 8 Strings Chapter 9 Inheritance and Polymorphism GUI can be covered after 10.2, Abstract Classes Chapter 12 GUI Basics 10.2, Abstract Classes Chapter

More information

Java Primer. CITS2200 Data Structures and Algorithms. Topic 2

Java Primer. CITS2200 Data Structures and Algorithms. Topic 2 CITS2200 Data Structures and Algorithms Topic 2 Java Primer Review of Java basics Primitive vs Reference Types Classes and Objects Class Hierarchies Interfaces Exceptions Reading: Lambert and Osborne,

More information

Day 4. COMP1006/1406 Summer M. Jason Hinek Carleton University

Day 4. COMP1006/1406 Summer M. Jason Hinek Carleton University Day 4 COMP1006/1406 Summer 2016 M. Jason Hinek Carleton University today s agenda assignments questions about assignment 2 a quick look back constructors signatures and overloading encapsulation / information

More information

Programming overview

Programming overview Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in

More information

PROGRAMMING III OOP. JAVA LANGUAGE COURSE

PROGRAMMING III OOP. JAVA LANGUAGE COURSE COURSE 3 PROGRAMMING III OOP. JAVA LANGUAGE PREVIOUS COURSE CONTENT Classes Objects Object class Acess control specifier fields methods classes COUSE CONTENT Inheritance Abstract classes Interfaces instanceof

More information

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA

B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA B2.52-R3: INTRODUCTION TO OBJECT ORIENTATED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE

More information

CST141 Thinking in Objects Page 1

CST141 Thinking in Objects Page 1 CST141 Thinking in Objects Page 1 1 2 3 4 5 6 7 8 Object-Oriented Thinking CST141 Class Abstraction and Encapsulation Class abstraction is the separation of class implementation from class use It is not

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

More information

Interface Class. Lecture 22. Based on Slides of Dr. Norazah Yusof

Interface Class. Lecture 22. Based on Slides of Dr. Norazah Yusof Interface Class Lecture 22 Based on Slides of Dr. Norazah Yusof 1 Interface & Implements An interface is a classlike construct that contains only constants variables and abstract methods definition. An

More information

CSC207H: Software Design. Java + OOP. CSC207 Winter 2018

CSC207H: Software Design. Java + OOP. CSC207 Winter 2018 Java + OOP CSC207 Winter 2018 1 Why OOP? Modularity: code can be written and maintained separately, and easily passed around the system Information-hiding: internal representation hidden from the outside

More information

COMP1008 An overview of Polymorphism, Types, Interfaces and Generics

COMP1008 An overview of Polymorphism, Types, Interfaces and Generics COMP1008 An overview of Polymorphism, Types, Interfaces and Generics Being Object-Oriented Exploiting the combination of: objects classes encapsulation inheritance dynamic binding polymorphism pluggability

More information

Making New instances of Classes

Making New instances of Classes Making New instances of Classes NOTE: revised from previous version of Lecture04 New Operator Classes are user defined datatypes in OOP languages How do we make instances of these new datatypes? Using

More information

Lesson11-Inheritance-Abstract-Classes. The GeometricObject case

Lesson11-Inheritance-Abstract-Classes. The GeometricObject case Lesson11-Inheritance-Abstract-Classes The GeometricObject case GeometricObject class public abstract class GeometricObject private string color = "White"; private DateTime datecreated = new DateTime(2017,

More information

Unit 3 INFORMATION HIDING & REUSABILITY. Interface:-Multiple Inheritance in Java-Extending interface, Wrapper Class, Auto Boxing

Unit 3 INFORMATION HIDING & REUSABILITY. Interface:-Multiple Inheritance in Java-Extending interface, Wrapper Class, Auto Boxing Unit 3 INFORMATION HIDING & REUSABILITY Interface:-Multiple Inheritance in Java-Extending interface, Wrapper Class, Auto Boxing Interfaces interfaces Using the keyword interface, you can fully abstract

More information

CSE1720. General Info Continuation of Chapter 9 Read Chapter 10 for next week. Second level Third level Fourth level Fifth level

CSE1720. General Info Continuation of Chapter 9 Read Chapter 10 for next week. Second level Third level Fourth level Fifth level CSE1720 Click to edit Master Week text 08, styles Lecture 13 Second level Third level Fourth level Fifth level Winter 2014! Thursday, Feb 27, 2014 1 General Info Continuation of Chapter 9 Read Chapter

More information

1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4'

1. Which of the following is the correct expression of character 4? a. 4 b. 4 c. '\0004' d. '4' Practice questions: 1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4' 2. Will System.out.println((char)4) display 4? a. Yes b. No 3. The expression "Java

More information

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented

Subclass 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 information

TeenCoder : Java Programming (ISBN )

TeenCoder : Java Programming (ISBN ) TeenCoder : Java Programming (ISBN 978-0-9887070-2-3) and the AP * Computer Science A Exam Requirements (Alignment to Tennessee AP CS A course code 3635) Updated March, 2015 Contains the new 2014-2015+

More information

25. Generic Programming

25. Generic Programming 25. Generic Programming Java Fall 2009 Instructor: Dr. Masoud Yaghini Generic Programming Outline Polymorphism and Generic Programming Casting Objects and the instanceof Operator The protected Data and

More information

CISC370: Inheritance

CISC370: Inheritance CISC370: Inheritance Sara Sprenkle 1 Questions? Review Assignment 0 due Submissions CPM Accounts Sara Sprenkle - CISC370 2 1 Quiz! Sara Sprenkle - CISC370 3 Inheritance Build new classes based on existing

More information

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Object 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 information

WA1278 Introduction to Java Using Eclipse

WA1278 Introduction to Java Using Eclipse Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc WA1278 Introduction to Java Using Eclipse This course introduces the Java

More information

Topic 5: Abstract Classes & Interfaces

Topic 5: Abstract Classes & Interfaces Topic 5: Abstract Classes & Interfaces Classes seen so far: concrete classes -- completely specified Abstract class: incomplete class, useless by itself, meant for use as a superclass. Interface: a special

More information

CS260 Intro to Java & Android 03.Java Language Basics

CS260 Intro to Java & Android 03.Java Language Basics 03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance

More information

Methods Common to all Classes

Methods Common to all Classes Methods Common to all Classes 9-2-2013 OOP concepts Overloading vs. Overriding Use of this. and this(); use of super. and super() Methods common to all classes: tostring(), equals(), hashcode() HW#1 posted;

More information

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs. Java SE11 Development Java is the most widely-used development language in the world today. It allows programmers to create objects that can interact with other objects to solve a problem. Explore Java

More information

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and Classes CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

CS 251 Intermediate Programming Methods and More

CS 251 Intermediate Programming Methods and More CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

Today. Book-keeping. Inheritance. Subscribe to sipb-iap-java-students. Slides and code at Interfaces.

Today. Book-keeping. Inheritance. Subscribe to sipb-iap-java-students. Slides and code at  Interfaces. Today Book-keeping Inheritance Subscribe to sipb-iap-java-students Interfaces Slides and code at http://sipb.mit.edu/iap/java/ The Object class Problem set 1 released 1 2 So far... Inheritance Basic objects,

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Interface Abstract data types Version of January 26, 2013 Abstract These lecture notes are meant

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance (part II) Polymorphism Version of January 21, 2013 Abstract These lecture notes

More information