You are tasked with designing a lightweight 3D point class to be used in a performance-critical graphics application. The class should store three float values and should allow public access to these without using getters and setters. Which user-defined data type would be best suited for this purpose?
- Class
- Struct
- Union
- Array
In C++, structs are typically used for lightweight user-defined data types. They default to public member access, making it easier to access the members directly without the need for getters and setters. Classes default to private access and are generally used when encapsulation is a primary concern.
Loading...