[Tutor] Classes and the like...

Alan Gauld alan.gauld at blueyonder.co.uk
Sat Sep 20 12:15:58 EDT 2003


> Object? What's an object? 

:-)

> Any ideas on a fairly simple project I could do next?

THe ones I always use when trying out a new OO language 
for the first time are:

1) A Hello World program using a message object

Initialise it with no parameters it prints Hello World.
Initialise it with a string parameter and it prints the string.
Change the text attribute and it prints the new value.

2) A switch. It can have state ON or OFF. You can Set it 
to ON or OFF. It can tell you its state.

3) A Toggle switch inheriting from the switch above.
It only has 1 extra method which Toggles the state to 
the opposite of whatever its current state is.

4) A bank of switches that I can manipulate(to tst polymorphism)

Thats it, after doing that I usually have a good feel of basic 
OO programming in whatever language it is.

Alan G.





More information about the Tutor mailing list