|
-
Apr 23rd, 2007, 09:55 PM
#1
Thread Starter
Admodistrator
Method available to all instances of class?
I remember reading about a type of method that all objects of that class can access, and it is the same for all of them. Maybe I read wrong. Or maybe this is more of a code setup question.
Anyways, we are writing a bookStore class, it lets you choose any book you like by author or title and you can sort all the books by title or author. My trouble begins when I try and sort by something other than Title, because I have that set in code. We are extending Comparable in the Book class, and using CompareTo to sort the books. It works perfect if I just want to sort by title, but what about author?
I know I could set a variable in each object of Book, but thats just wasted memory when I feel there is a better solution
I hope you can understand my question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|