Diff b/w Class and Structure?

  • Both can have Constructors,Methods,Properties,Fields,Constants,Enumerations,Events,Delegates and Event Handlers
  • Both can have Constructors with or with out parameters
  • Both can implement interfaces
  • Classes are reference type so stored in heap memory
  • Structures are value types so stored in stack memory
  • Class members can be declared as Protected
  • Structure members can't be created as Protected
  • We can do inheritance in classes
  • we can't do inheritance in structures



No comments:

Post a Comment