CSC/ECE 517 Fall 2011/ch1 1h ps: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<font size=5>Common Attribute/Member Syntax</font><br> | <font size=5>Common Attribute/Member Syntax</font><br> | ||
Different object oriented programming languages include different ways of accessing the member variables and methods. This page discusses the various usages and their advantages and disadvantages. | Different object oriented programming languages include different ways of accessing the member variables and methods. This page discusses the various usages and their advantages and disadvantages. | ||
== Introduction == | == Introduction == | ||
<p>The purpose of [http://en.wikipedia.org/wiki/Object-oriented_programming/ Object Oriented Programming] is to make programs model things the way people think or deal with the world.</p> | <p>The purpose of [http://en.wikipedia.org/wiki/Object-oriented_programming/ Object Oriented Programming] is to make programs model things the way people think or deal with the world i.e it's modeled around data rather than logic. Objects form the basis of OOP. Let us now look at objects, their manipulation and the ways to do so.</p> | ||
== Objects == | == Objects == | ||
<table> | |||
<tr> | |||
<td> | |||
<p>Similar to real world objects, software objects also consist of state and related behavior. An object stores it's state in <i>attributes</i> and exposes its behavior through <i>methods</i>. Let's look at the pseudo code for a bicycle object.</p><br> | |||
</td> | |||
<td>[[File:concepts-object.gif]]</td> | |||
</tr> | |||
<tr colspan="2"> | |||
<td> | |||
<pre> | <pre> | ||
CLASS Bicycle | |||
ATTRIBUTES: | |||
speed: NUMBER | |||
gear: NUMBER | |||
pedal_cadence: NUMBER | |||
METHODS: | |||
ride(speed) | |||
changeGear(gear) | |||
changeCadence(pedal_cadence) | |||
</pre> | </pre> | ||
</td> | |||
</tr> | |||
Revision as of 23:18, 7 September 2011
Common Attribute/Member Syntax
Different object oriented programming languages include different ways of accessing the member variables and methods. This page discusses the various usages and their advantages and disadvantages.
Introduction
The purpose of Object Oriented Programming is to make programs model things the way people think or deal with the world i.e it's modeled around data rather than logic. Objects form the basis of OOP. Let us now look at objects, their manipulation and the ways to do so.