[Tutor] multiple class instances
K P
teroc@zianet.com
Mon, 10 May 1999 08:32:00 -0500
-------Phoenix-Boundary-07081998-
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: Quoted-printable
How can I create multiple class instances (objects=3F) that do not share
the same data=3F For example the following class:
class Spam:
choice =3D "I\'ll have the spam"
if I create an instance:
spam1 =3D Spam
Then reassign a data member:
spam1.choice =3D "Do you have anything besides spam=3F"
Then create a new instance:
spam2 =3D Spam
Then print spam2.choice, it will print the value assigned above:
spam2.choice
'Do you have anything besides spam=3F'
So my question, restated, is how can I have spam1 and spam2 based on Spam,
and yet have different data for the same variables/members=3F
further example, I would like this be the printout for spam1.choice and
spam2.choice:
spam1.choice
'Do you have anything besides spam=3F'
spam2.choice
'I'll have the spam'
disclaimer:
It's been awhile since I saw the spam sketch so if I mis-quoted it......
Ken
-------Phoenix-Boundary-07081998---