-
Expert Member
will it compile?
hi friends
I have an interface that is implemented by 100 classes, if I add a method to the interface will my classes compile? How can I fix any errors?
-
Expert Member
Re: will it compile?
Hi,
All the implementing classes will not compile. An interface is a contractual obligation. By implementing that interface you are guaranteeing that your class will fulfill its contractual obligation. If you add a new method to an interface then, by definition, all classes implementing that interface will have to implement the new method.
Regards
Nikhil Rattan
-
Junior Member
Re: will it compile?
lets say you have an interface IInterface which is implemented by 100 classes.
Now u wana add a method to the interface but not all of the implemented classes need to add the method.
Create another interface lets say
ISubInterface implements IInterface
Now use any one depending on your requirement.
There is no other way to fix ur problem
-
Junior Member
Re: will it compile?
hi Masif,
small correction, an interface can only extend another interface but an interface can not implement another interface.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules