stracutres does not suport single inheritance ,but its suportting multiple inheritance ? [Resolved]

Posted by Harieswer under C# on 8/12/2015 | Points: 10 | Views : 319 | Status : [Member] | Replies : 1
structures does not support single inheritance because its value type ,but its supporting multiple inheritance by interfaces why ?


Posted by: Rajnilari2015 on: 9/28/2015 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50


But Structures don't at all supports inheritance because it is Value Type and the reason value types can't support inheritance is because of arrays. There is no indirection via a reference pointer. Objects normally live on the heap and are referenced via reference pointers, but structs are allocated on the stack (unless they are boxed) or are allocated "inside" the memory occupied by a reference type on the heap.

Thanks & Regards,
RNA Team

Harieswer, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response