Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
java class hierarchy
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Oliver Wong, post: 2984305"] There's no hard and fast rule, but as a rule of thumb, in this situation you would use the least general type which is a supertype of all the possible types you might get from your FIFO queue. The issue is that you will probably want to do something with each element you take out of the queue. Usually, to "do something" involves invoking a method. Which means the method you want to invoke must be part of the type of the reference (or you could use casting, but that gets messy). So say if you wanted to call the .doSomething() method on each element, the type of the reference would need to be such that the ..doSomething() method is defined on that type. If the .doSomething() method is defined in Symbol, then use Symbol as the type of the reference. If the method is defined in Evaluate, then use Evaluate. If it's defined in both, then it doesn't matter too much which one you use. - Oliver [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
java class hierarchy
Top