Can we convert IRoom 's Instance into ITurnBasedRoom's Instance?

0 votes

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

 

closed with the note: Closing this thread as there was no update from last 2 Weeks or more. Please raise a new query if problem persists.
asked Aug 16, 2016 in AppWarpS2 by bicubic.unity02 (22 points)
closed Nov 4, 2016 by shepAdmin
Could you please let me know the use-case of type-casting IRoom to ITurnBasedRoom?
It will help us to understand the requirement and will suggest you the better way to achieve.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...