I came across this question in interview; We can not instantiate abstract class and interface then why can not we declare variable in interface though we can declare it in abstract class?
Asked
Active
Viewed 72 times
2
-
An interface is a contract without implementation details like fields. An abstract class can be used interface-like, but can contain implementation details for derived classes (reusability). – KBO Jan 30 '19 at 07:01
-
_Fields_ are supposed to be internal to a class object. Where they need to be exposed, they should be done through _properties_. An interface allows you to define properties. – ProgrammingLlama Jan 30 '19 at 07:01