CS2_15_ObjectsClassesObjCreation

CS2_15_ObjectsClassesObjCreation - CS2 Module 15 Category:...

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

View Full Document Right Arrow Icon
CS2 Module 15 Category: OO Concepts Topic: Objects, Classes, Constructors and Object Creation Objectives: Introduction
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS 2 Introduction to Object Oriented Programming Module 15 OO Concepts Objects, Classes and Object Creation
Background image of page 2
Classes and Objects
Background image of page 3

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

View Full DocumentRight Arrow Icon
Recall from Scheme The posn structure (define-struct posn (x y)) defined the posn structure (make-posn 3 4) created a posn structure with two fields identified as x and y And to extract these values. .. (posn-x (make-posn 3 4)) 3 (posn-y (make-posn 3 4)) 4
Background image of page 4
Recall from Scheme (define-struct posn (x y)) defined the posn structure This serves as a template telling us the number and names of fields in a posn structure
Background image of page 5

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

View Full DocumentRight Arrow Icon
Recall from Scheme (make-posn 3 4) created a posn structure with two fields identified as x and y This creates a posn structure and initializes the values of x and y It also returns a reference to the area in memory where this structure is stored
Background image of page 6
Recall from Scheme (posn-x (make-posn 3 4)) 3 This extracts the value of one of the members of the posn structure It is a behavior defined for structures: the ability to extract the value of individual members
Background image of page 7

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

View Full DocumentRight Arrow Icon
What is an object? A chunk of memory which contains some data and methods which can operate on the data. Something that when created may have had special code run to initialize it. Something which has additional behavior defined by methods which can Be passed data via parameters Perform calculations/operations which may • Change some of its data Perform some desired operation Return the value of some of its data Return the results of calculations using both data passed in and data contained in the object
Background image of page 8
How do we define different types of objects?
Background image of page 9

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

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

This note was uploaded on 01/23/2012 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Tech.

Page1 / 28

CS2_15_ObjectsClassesObjCreation - CS2 Module 15 Category:...

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

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