2

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?

DiplomacyNotWar
  • 31,605
  • 6
  • 57
  • 75
umesh_vn
  • 85
  • 4
  • 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. – DiplomacyNotWar Jan 30 '19 at 07:01

0 Answers0