user image

Gagan Mishra

Job Interview Skills
English
2 years ago

Question 582. What Is The Difference Between A Struct And A Class?

user image

Abhishek Mishra

2 years ago

The struct type is suitable for representing lightweight objects such as Point, Rectangle, and Color. Although it is possible to represent a point as a class, a struct is more efficient in some scenarios. For example, if you declare an array of 1000 Point objects, you will allocate additional memory for referencing each object. In this case, the struct is less expensive.

Recent Doubts

Close [x]