adspace


Why can’t struct be used instead of class for storing entity?

Answer Posted / Jeetender Pal Singh

In C#, structures (structs) are value types while classes are reference types. This difference leads to some limitations when using structs as entities. For instance, they cannot inherit from multiple base classes or implement interfaces, they don't support constructors with parameters, and they don’t have a built-in concept of inheritance. Structs also can’t be used to create a true object-oriented programming (OOP) model like classes.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an abstract class c#?

969


Why can't we use a static class instead of singleton?

954


How to assign Null value to Var?

1063


How do you inherit a class into other class in c#?

994


Which namespaces are necessary to create a localized application?

1142


What is expression tree in c#?

998