Reputation: 83
struct Movement {
int left = 0;
int right = 0;
};
struct TurnLeft : Movement {
left = 200;
right = MAX_SPEED;
};
I want TurnLeft to override left and right. How?
Upvotes: 0
Views: 54
Reputation: 93324
There's no way of doing this without a constructor. Example:
struct Movement {
int left = 0;
int right = 0;
};
struct TurnLeft : Movement {
TurnLeft() : Movement{200, MAX_SPEED} { }
};
Upvotes: 6