• anonymous
Hi everybody, I am a bit of a noob to the site and need some help understanding classes. I have got up to Homework 3, Exercise 3.6 without much bother, but now I'm not even sure what the question is asking. As far as I understand it initializing a class is defining the kind of attributes its objects can have. So for a FIFO queue what kind of attributes would that be? Would each item in the queue be a separate object/instance? If anyone has any ideas or helpful links it would be so appreciated! Thanks guys!
Computer Science
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • jamiebookeater
I got my questions answered at in under 10 minutes. Go to now for free help!
  • anonymous
Sorry I thought this was going in the Intro to Python section, but if you guys can still help, the question is to create a class Queue that creates a first in first out list of items. I think my problem more though is that I just basically dont understand what on earth a class is. Why wouldn't you just use a list and pop the top answer?
  • anonymous
From noob to noob.. ;) You don't want to create a list because the class allows you to give attributes to your object. Im not on the hw3 yet but what you can do with a class is that your first item could bear the attribute 'first', your list would go through a calculation (of the first) each time. A class allows you to create 'object' with specifications that a list can't be aware, when your class will : The difference between 95% water with some minerals and a human being. Same materials but one is easier to talk with. The chapter 12 of thinkcspy is quite clear if you didn't get the chance to read it yet.
  • rsmith6559
A class is a design, containing attributes and actions (functions/methods) that an object has. Objects are created from a class, this is called instantiation. In the case of a Queue class, it would have an array, list or tree to store whatever is in queue. You'd have public methods (can be called by the programmer using your class) that would add to the queue, remove from the queue and maybe report how many items are in queue. You'd have private methods (the programmer using your class doesn't have access to these) to manage your storage.

Looking for something else?

Not the answer you are looking for? Search for more explanations.