ClassesAndObjects2

ClassesAndObjects2 - CI S3023 Pr ogr amming Fundament als...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Classes and Objects (contd.) Course Lecture Slides 19 May 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Click to edit Master subtitle style Classes and Objects Credits: Adapted from CIS-3023 lecture slides (Spring 2010) by Dr Seema Bandyopadhyay , University of Florida, Gainesville. 22
Background image of page 2
Object Instantiation Declaring and Creating object in two steps Declaring and Creating object in single step 33 // <ClassName> <objectRefVar>; Circle myCircle; myCircle = new Circle(); // <ClassName> <objectRefVar> = new <ClassName>(); Circle myCircle = new Circle();
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Trace Code 44 Circle myCircle = new Circle(5.0); Circle yourCircle = new Circle(); yourCircle.radius = 100; Declare myCircle no value myCircl e animation
Background image of page 4
Trace Code, cont. 55 Circle myCircle = new Circle(5.0); Circle yourCircle = new Circle(); yourCircle.radius = 100; no value myCircl e Create a circle animation
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Trace Code, cont. 66 Circle myCircle = new Circle(5.0); Circle yourCircle = new Circle(); yourCircle.radius = 100; reference value myCircl e Assign object reference to myCircle animation
Background image of page 6
Trace Code, cont. 77 Circle myCircle = new Circle(5.0); Circle yourCircle = new Circle(); yourCircle.radius = 100; reference value myCircl e no value yourCircl e Declare yourCircle animation
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Trace Code, cont. 88 Circle myCircle = new Circle(5.0); Circle yourCircle = new Circle(); yourCircle.radius = 100; reference value myCircl e no value yourCircl e : Circle ra dius: 1.0 Create a new Circle object animation
Background image of page 8
Trace Code, cont. 99 Circle myCircle = new Circle(5.0); Circle yourCircle = new Circle( ); yourCircle.radius = 100; reference value myCircl e reference yourCircl e : Circle radius: 1.0 Assign object reference to yourCircle animation
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Accessing Objects Referencing the object’s data: Invoking the object’s method: 1010 // objectRefVar.data myCircle.radius //objectRefVar.methodName(arguments) myCircle.getArea()
Background image of page 10
Trace Code, cont.
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/27/2011 for the course CIS 3023 taught by Professor Dobbins during the Summer '08 term at University of Florida.

Page1 / 34

ClassesAndObjects2 - CI S3023 Pr ogr amming Fundament als...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online