Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. CO1. I'm developing a game for an academic project; I'm in the Board class which should manage the object that are in the board. Since I want the Board(lie, my teacher wants it =P) to be as generic as possible(to allow the Board to be used in another games, for example), I'm working with a custom interface Piece. I want to create a method "Piece onColision(Piece p)", the piece compares itself to another and returns the remaining one(p or this). 2. This method is purely hypotetic, there's no real implementation to it.
      singulars
    2. COIn that case, I would still return the interface type. When two pieces collide you're only interested that a piece is returned. If necessary, you can access the type later by way of o.getClass(). In a response above, you talk about the fact that A a = x.getSelf() cannot always be used. That is the exact reason why what you are trying to implement isn't really supported: there is no real way to use it without lots of type casting, which would seem to make your program *less* generic rather than more.
      singulars
    3. COThis is true for the return type, but I was curious about the receiving parameter. The class which implements Piece should receive an reference to an object of it's own class, that way thay can compare thenselves using specif fields of that class. Example: ChessPiece should compare itself to another different from how TableRPGPiece does.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload