Top Banner
YHL Object and Class 1 ECE 462 Object-Oriented Programming using C++ and Java Object and Class Yung-Hsiang Lu [email protected]
178

ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

Mar 13, 2018

Download

Documents

dinhminh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 1

ECE 462Object-Oriented Programming

using C++ and Java

Object and ClassYung-Hsiang Lu

[email protected]

Page 2: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 2

What is an Object?

An object can be a “concrete and tangible” entity that can be separated with unique properties:– you– your book– your car– my computer– Tom– Amy’s computer– your phone– Sam’s digital camera– Jennifer’s cat ...

Page 3: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 3

What is an object?

• An object can be abstract and does not have to be tangible:– Purdue ECE's student database – the email sent by Mark at 9:07AM on 2008/03/22– the web page of Purdue ECE 462– the song played in WBAA at 7:02PM last night

• An object can contain other objects:– a car = wheels + engine + door + windshield + ...– a house = kitchen + bedrooms + living room + ...– a laptop = keyboard + display + processor + ...

Page 4: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 4

Objects' Three Properties

• Each object is unique and can be identified using name, serial number, relationship with another object ...

• Each object has a set of attributes, such as location, speed, size, address, phone number, on/off ...

• Each object has unique behaviors, such as ring (phone), accelerate and move (car), take picture (camera), send email (computer), display caller (pager)

• Each object has three important properties:– unique identity– attributes, noun– behavior (action), verb

Page 5: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 5

Objects’ Interactions

• You (object) press (action) the pedal (object) of your car (object). As a result, your car accelerate (action).

• When your phone (object) rings (action) and alerts (action) you (object) of an incoming call (state), you answer (action) the call (state).

• You submit (action) homework (object) and it is graded (action) with a score (state).

Page 6: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 6

Object as a Special Case

• A person is an object. A student is also an object. A student is a special case of a person

⇒ A student has all attributes of a person:name, home address, parents ...

⇒ A student has all behavior of a person:eat, sleep, talk ...

⇒ A student has something that a person may not have:– attributes: student ID, list of courses, classmates ...– behavior: submit homework, take exam ...

Page 7: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 7

What is a Class?

• A class describes the commonalities of similar objects:– Person: you, David, Mary, Tom, Amy ...– Car: your Toyota Camry, his Ford Explorer, Jennifer's

Mercedes C300 ...– Classroom: EE170, EE117, EE129 ...– Building: EE, MSEE, Purdue Bell Tower, Hovde Hall...

• A class describes both the attributes and the behavior:– Person: name, home ... + sleep, eat, speak ...– Car: engine size, year ... + accelerate, brake, turn ...

Page 8: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 8

Relationship among Classes

• A class can be a special case of another class:– Student is a special case of Person– Sedan is a special case of Car– Laptop is a special case of Computer– Computer is a special case of ElectronicMachine

⇒ This is called a "is a" relationship.– any Student object is a Person object– any Sedan object is a Car object– any Laptop object is a Computer object– any Computer object is an ElectronicMachine object

Page 9: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 9

Class and Object

• An object is an instantiation (i.e. concrete example) of a class: – an object is unique– a class describes the common properties of many

objects• An object may contain an object. This must be described

in the former object's class. We can say that one class "has a" class.

Page 10: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 10

Encapsulation

• An object can hide information (attributes) from being manipulated by or even visible to other objects:

A person's name is given once when the object is created. This attribute is visible but cannot be changed.

• An attribute may be modified by only restricted channels to keep consistency.

A person's address and phone number must be change together when this person moves.

Page 11: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Object and Class 11

Self Test

Page 12: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 1

ECE 462Object-Oriented Programming

using C++ and Java

Inheritance and PolymorphismYung-Hsiang Lu

[email protected]

Page 13: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 2

Inheritance = "Is A"

• Any Student object is a Person object. Student class is a derived class of Person. Person is the base class.

⇒ Person is more general, with fewer attributes and behaviors.

⇒ Student is more specific, with more attributes (school, major) and behaviors (submit homework, take exam).

• Any TabletPC object is a Computer object. TabletPCclass is a derived class of Computer.

⇒ Computer is more general.⇒ TabletPC is more specific, with more attributes (battery

lifetime) and behavior (close or turn the screen)

Page 14: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 3

Derived Class

• A class may have multiple derived classes:– Car: Sedan, Truck, Sport Utility Vehicle, Sport Car ...– Computer: Laptop, Desktop, Server – Person: Student, Teacher, Father, Mother ...

• A derived class may also have derived classes:– Vehicle: Car, Bike ... Car: Sedan, Truck ...– Animal: Bird, Mammal ... Mammal: Dog, Cat ...

• Use "base" and "derived" classes. Do not use "super" and "sub" classes. A base class or a superclass is "smaller" (fewer attributes and behaviors) ⇒ too confusing

Page 15: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 4

Why Object-Oriented?

• Object-oriented programming (OOP) is more natural to describe the interactions between "things" (i.e. objects).

• OOP provides better code reuse:– commonalities among objects described by a class– commonalities among classes described by a base

class (inheritance)• Objects know what to do using their attributes:

Each object responds differently to "What is your name?" • OOP provides encapsulation: hide data that do not

have to be visible to the other objects or protect data from unintentional, inconsistent changes.

Page 16: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 5

Interface ≠ Implementation

If a behavior is common among classes, the behavior should be available in their base class. However, this behavior may need additional information from derived classes and must be handled in derived classes.– Shape: contains color, lineStyle ... attributes– Shape supports getArea behavior– getArea cannot be handled by Shape– getArea must be handled by

individual derived classes– getArea implemented in derived classes

Shape

Circle

Triangle

Rectangle

Page 17: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 6

Override Behavior

• Polygon can support getArea.• Derived classes (such as Triangle,

Square, and Pentagon) can have better (faster) ways to getArea.

⇒ getArea is implemented in Polygon andthe derived classes.

• A Polygon object calls getArea in Polygon• A Square object calls getArea in Square if getArea is

implemented in Square.• A Pentagon object calls getArea in Polygon if getArea is

not implemented in Pentagon.

Polygon

Square

Triangle

Pentagon

Page 18: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 7

Overriding

ErrorDNN

ErrorBNN

DDerivedYN

ErrorBaseYN

BDNY

BBNY

DerivedDerivedYY

BaseBaseYY

ExecuteObjectDerivedBase

The behavior implemented in a sibling class (such as Square-Triangle) has no effect.

Page 19: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 8

Class and Object

Polygon p1; // this is a comment: p1 is a Polygon objectp1.getArea(); // call the implementation in PolygonSquare s2; // s2 is a Square objectp1 = s2; // p1 now behaves likes a square// a Square object is always a Polygon objectp1.getArea(); // implementation in Square (if available)// polymorphisms2 = p1; // error// a Polygon object may not be a Square object

Page 20: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 9

Fundamental Concepts in OOP

• object and class • encapsulation• inheritance• polymorphism

Page 21: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 10

Self Test

Page 22: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 11

Java and Qt Documentations

Page 23: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 12

Page 24: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 13

Page 25: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 14

Page 26: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 15

Page 27: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 16

Page 28: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 17

Page 29: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 18

Page 30: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 19

Page 31: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 20

Page 32: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 21

Page 33: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 22

Page 34: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 23

Page 35: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 24

Page 36: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 25

Page 37: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 26

Page 38: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Inheritance and Polymorphism 27

Page 39: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 1

ECE 462Object-Oriented Programming

using C++ and Java

Development EnvironmentYung-Hsiang Lu

[email protected]

Page 40: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 2

Demonstrations

• develop C++ project in Eclipse• develop Java project in Eclipse• develop Java project in Netbeans (in handout)• compile / execute C++ program in Linux shell• compile / execute Java program in Linux shell

• Program: Person and Student classes.

Page 41: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 3

Set up Execution Environment

• You can use Netbeans or Eclipse for developing Java or C++ projects.

• Please remember to use your ee462xxx account in MSEE190. Your personal Purdue account will not work.

• Do not use the ee462xxx account for any other purpose.• After the final exam, the account will be erased and

the password will be reset.

Page 42: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 4

Install Eclipse at Your Own Computer

Page 43: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 5

Page 44: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 6

Page 45: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 7

Page 46: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 8

Page 47: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 9

Page 48: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 10

Page 49: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 11

Page 50: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 12

Page 51: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 13

ready to runno need to install anything

Page 52: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 14

Page 53: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 15

Page 54: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 16

Page 55: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 17

Page 56: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 18

Page 57: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 19

Page 58: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 20

Page 59: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 21

Page 60: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 22

Page 61: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 23

Page 62: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 24

Page 63: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 25

Page 64: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 26

Page 65: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 27

Page 66: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 28

Close Overview

Page 67: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 29

Develop C++ Projects in Eclipse

Page 68: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 30

Page 69: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 31

Page 70: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 32

Page 71: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 33

Page 72: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 34

Page 73: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 35

Page 74: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 36

Page 75: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 37

The code here is automatically generated.

Page 76: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 38

Page 77: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 39

Page 78: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 40

Page 79: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 41

Page 80: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 42

Page 81: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 43

Page 82: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 44

Page 83: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 45

Page 84: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 46

Page 85: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 47

Page 86: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 48

Page 87: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 49

Cannot change the name.

Page 88: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 50

Develop Java Projects in Eclipse

Page 89: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 51

Page 90: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 52

Page 91: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 53

Page 92: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 54

Page 93: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 55

Page 94: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 56

Page 95: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 57

Page 96: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 58

Page 97: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 59

Page 98: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 60

Page 99: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 61

Page 100: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 62

Page 101: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 63

Page 102: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 64

Page 103: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 65

Page 104: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 66

Page 105: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 67

Page 106: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 68

Page 107: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 69

Page 108: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 70

Page 109: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 71

Page 110: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 72

Page 111: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 73

C++ and Java Syntax

class Student extends Person class Student: public Person

final String p_lastName;const string p_lastName;

public class Person {public Person(String ln, String fn)

{

class Person{public:

Person(string ln, string fn);

p1.print();p1.print();

Person p1 = new Person("Johnson", "Tom");

Person p1("Johnson", "Tom");

public static void main(String[] args) {

int main(int argc, char * argv[])

Javac++

Page 112: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 74

Version Control

Every assignment and every lab exercise mustbe submitted using the CVS repository.

Submission of the source code only will not be graded.

Page 113: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 75

Page 114: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 76

Update and Commit

• update = pull the changes made by your teammates from the repository

• commit = push your changes to the repository so that your teammates can see

• update and commit often ⇒ keep your files and the repository "in sync"

• focus on one task at a time, finish it and commit it• commit after adding a feature or fixing a bug• use meaningful comments to indicate the progression of

the project

Page 115: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 77

Prepare a Repository

• enter your 462 account• make a directory called "projects"• enter the "projects" directory• make a directory called "CVSROOT"

Page 116: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 78

Page 117: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 79

Page 118: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 80

Page 119: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 81

Page 120: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 82

Page 121: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 83

Page 122: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 84

Version 1.1

Page 123: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 85

">" means the file has been changed

Page 124: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 86

Update: check whether your teammate has made any changes.

Page 125: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 87

Commit: allow your teammate to see the changes you have made.

Page 126: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 88

Always update before commit.

Otherwise, you may overwrite your teammate's changes.

It is recoverable but you shouldavoid such a problem.

Page 127: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 89

Only the changed file is shown.

Page 128: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 90

$Log$ is replaced by the commit history.

Page 129: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 91

Develop Java Projects in Netbeans

Page 130: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 92

Install Netbeans at Your Own Computer

Page 131: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 93

http://www.netbeans.org/

Page 132: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 94

Page 133: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 95

Page 134: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 96

Page 135: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 97

Page 136: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 98

Page 137: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 99

Page 138: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 100

Page 139: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 101

Page 140: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 102

Page 141: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 103

Page 142: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 104

Page 143: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 105

Page 144: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 106

Page 145: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 107

Page 146: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 108

Page 147: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 109

Page 148: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 110

Page 149: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 111

Attributes can be declared at the end of the class.

Page 150: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 112

Page 151: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 113

Page 152: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 114

Page 153: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 115

Page 154: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 116

Page 155: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 117

Page 156: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 118

Page 157: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 119

Page 158: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 120

Page 159: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 121

Page 160: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 122

Page 161: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 123

Page 162: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 124

Page 163: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 125

Page 164: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 126

Page 165: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 127

Page 166: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 128

Page 167: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 129

Compile / Execute C++ Programsin Linux Shell

Page 168: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 130

Page 169: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 131

Page 170: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 132

Page 171: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 133

Page 172: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 134

Page 173: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 135

Compile / Execute Java Programsin Linux Shell

Page 174: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 136

Page 175: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 137

Page 176: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 138

Remove package firstjava;

in the files

Page 177: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 139

Page 178: ECE 462 Object-Oriented Programming using C++ and · PDF fileYHL Inheritance and Polymorphism 1 ECE 462 Object-Oriented Programming using C++ and Java Inheritance and Polymorphism

YHL Development Environment 140

Self Test