And class structure

18. Please elaborate on the similarities and differences with the structure (struct) in a C # class (class)?

A: class can be instantiated, belonging to a reference type, and the interface class can implement other types of single inheritance, can also be used as a base type, is allocated on the heap memory

  struct type belongs value, not as a base type, but may be implemented interfaces, memory is allocated on the stack.

Guess you like

Origin www.cnblogs.com/jimsu/p/11184836.html