+ 9

Is there a difference between class and struct?

explain your answer and Don't forget to upvote

20th Nov 2017, 6:00 AM
Ashwin Jadhav
Ashwin Jadhav - avatar
3 Answers
+ 14
The main functional difference is that members of a structare public by default, while they are private by default in classes. Otherwise, as far as the language is concerned, they are equivalent. Source - https://stackoverflow.com/questions/54585/when-should-you-use-a-class-vs-a-struct-in-c
20th Nov 2017, 6:36 AM
qwerty
qwerty - avatar
+ 2
struct is your own type, like int or string, and what you could do: struct friends { int tell number; string name; ...others... } and use it : friends massive[2]; massive[0].name ="Anna"; So, the class - the pattern you can use to "build" same objects
20th Nov 2017, 10:12 AM
Đ˜Đ»ŃŒŃ Đ•Ń€ĐžĐœ
Đ˜Đ»ŃŒŃ Đ•Ń€ĐžĐœ - avatar