![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Feb 2006
Location: USA,Michigan
Posts: 22
Rep Power: 0
![]() |
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!" |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |