Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Oct 28th, 2006, 8:07 PM   #1
MR.T
Newbie
 
MR.T's Avatar
 
Join Date: Feb 2006
Location: USA,Michigan
Posts: 22
Rep Power: 0 MR.T is on a distinguished road
Classes question

I'm having a bit of trouble figuring out classes. Here's a rough example of what I'm trying to do:

class Item_Class:
def __int__(self):
self.Name
self.Description
self.Price

List[]
List.append(Item_Class)
List[0].Name = "Something"
List[0].Description = "Something"
List[0].Price = "Something"

That works fine. But if I append the class to the list a second time, and assign some values to it, the previous instance of the class is changed to those values also.
What am I doing wrong? Isn't the idea of classes to be able to make different instances of it?

thanks
__________________
"Gee, Brain, what do you want to do tonight?" "The same thing we do every night, Pinky: Try to take over the world!"
MR.T is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pointers to std::strings Question (and classes in general) Soulstorm C++ 3 Aug 1st, 2006 5:15 AM
Attitudes Oddball Coder's Corner Lounge 29 Mar 18th, 2006 9:34 PM
Could some please explain classes to me... TCStyle C++ 10 Feb 20th, 2006 3:51 PM
How to post a question nnxion C++ 10 Jun 3rd, 2005 11:53 AM
Nested Classes Question Arla C# 1 Apr 7th, 2005 4:05 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:45 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC