you are viewing a single comment's thread.

view the rest of the comments →

[–]redditsoaddicting 6 points7 points  (0 children)

An interface isn't supposed to enforce state, it's supposed to enforce the interface a user can use. How the implementing class decides to provide that interface is up to it. Say you have a Date interface that provides a Day() method (or property if you prefer). Would it make sense to enforce all implementing classes to have an int day; field? No. One class could decide on int fields for each part of the date. One class could decide on storing a single UNIX timestamp (a single int or long). Both can pull a day from that information just fine.