您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Content Index

Content Page # 25

Operations

A class is defined in terms of its attributes and its operations. An operation is some action an object of the class performs – the behaviour of an object is made up of the particular operations it executes.

Staying with the example of the class LibraryItem, operations that might be defined for an object of the class include:

  • setting the loan status attribute to the value ‘on loan’ or ‘on shelves’
  • tell us the ‘loan fee’ value (i.e. the object tells another object/part of the system the value of one of its attributes)
  • set the ‘due date’ (e.g. to be the first working day after the current date plus the ‘loan duration’)

Operations are implemented as methods in programming languages such as Java.

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg