0
class or struct
What is the difference and why use one over the other?
2 Réponses
+ 8
https://www.sololearn.com/Discuss/134212/?ref=app
As for when to use one over the other, Microsoft has a say:
https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/choosing-between-class-and-struct
0
The difference b/w them is :
1 Class can have member functions while struct cannot.
2 Class can have different scopes like private, protected and public while struct don't.
3 Private and protected mode ensures data security and hiding while structures can only be public.
So a class is better than a structure.