0

Class vs Struct difference ?

Is there any significant change in space/time difference between both the methods ?

31st Mar 2017, 2:36 AM
Shivansh
Shivansh - avatar
5 Réponses
+ 16
31st Mar 2017, 2:52 AM
Hatsy Rei
Hatsy Rei - avatar
+ 10
Only difference is that structs have public members by default.
31st Mar 2017, 2:40 AM
Karl T.
Karl T. - avatar
+ 8
@Kinshuk .I think you're confusing C# with C++. Why do we use reference (&) then to pass objects?
31st Mar 2017, 3:22 AM
Karl T.
Karl T. - avatar
+ 4
@Helioform I read that here few weeks ago : www.differencebetween.info/difference-between-class-and-structure-in-cplusplus I thought that was what they meant by 'type' ... Maybe they meant something else...
31st Mar 2017, 4:18 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 3
Another difference is that data in classes is passed by reference , while it is passed by value in structures by default...
31st Mar 2017, 3:13 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar