On the program I'm writing I have a class RestrictedUser and class User that is derived from RestrictedUser. I'm trying to hide the User specific methods by casting to RestrictedUser but when I do the casting the User methods are still available. Also when I run the debugger the type of the variable comes up as User.
RestrictedUser restricted = regularUser;
Does up casting in Java hide the subclass methods and fields or am I doing something wrong? Is there a workaround?
Thanks