Arkanoid Remake
1.0
|
Vector with two (double precision) coordinate values. More...
#include <VecXy.h>
Public Member Functions | |
VecXy (double vx=0.0, double vy=0.0) | |
Constructor. | |
Public Attributes | |
double | X |
Horizontal coordinate. | |
double | Y |
Vertical coordinate. | |
Vector with two (double precision) coordinate values.
This data structure is an example of a C++ hybrid implementation. The struct defines only the data members and a default constructor, with an optional initialization list, but the implementation of the operations on the struct is demanded to the overridden operators. While a pure object-oriented approach requires the implementation of the operations defining methods inside a class, in C++ this hybrid solution allows to extend classes and structures that were not designed to be extended (e.g. primitive types and classes in the standard library). In the case of the VecXy struct we have at least two operations that cannot be implemented as class members: the multiplication and the division of a number with a VecXy object.