I know the the concept of interface and implementation of it also
I know properties and method definitions can be written interface .
But while going through topics related i came to know that we cant declare a variable in interface . Just wanted to know the reason for it ?
Lets say that it can be defined. So:
So, in each derived class (class that implements Foo interface) you would have to create two public members. That, at least to me, makes no sense.
If you want your classes to have some members that are not methods, and you would like to simplify it as much as possible, take a look at Auto-Implemented Properties.