0

class or struct

What is the difference and why use one over the other?

26th Jul 2017, 5:00 AM
Corey Ackland
Corey Ackland - avatar
2 Réponses
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.
26th Jul 2017, 7:33 AM
Lakshay
Lakshay - avatar