i want to convert IRoom in to ITurnBasedRoom Using TypeCasting but it shows me errror.I used following code for typecasting task
@Override
public void onAdminRoomAdded(IRoom room)
{
System.out.println("Admin Room Added : "+room.getId() + " Is TurnBased Room : " + room.isTurnBased());
if(!room.isTurnBased())
{
ITurnBasedRoom turnRoom = (ITurnBasedRoom)room;
turnRoom.setAdaptor(new PokerTurnBasedRoom(izone, (ITurnBasedRoom)turnRoom));
}
}
It Shows Me Following Error :
Exception in thread "main" java.lang.ClassCastException: com.shephertz.app42.server.domain.Room cannot be cast to com.shephertz.app42.server.idomain.ITurnBasedRoom