It makes complete sense. If a class implements an interface then it promises to implement every member of that interface. Even if you can't create an instance of ClassA directly you can still have instances of that class. Extending the example above, you can do this:If you were allowed to do as you want and not provide an implementation of MethodB in ClassA, the line I've marked with the asterisks would be illegal because ClassA would have no MethodB. Now that wouldn't make sense.Code:ClassB obj1 = new ClassB(); obj1.MethodB(); ClassA obj2 = (ClassA)obj1; obj2.MethodB(); // *** InterfaceA obj3 = (InterfaceA)obj2; obj3.MethodB();




Reply With Quote