[DiscordArchive] And how does directly manipulating member variables solve this problem?
[DiscordArchive] And how does directly manipulating member variables solve this problem?
Archived author: chipzz • Posted: 2024-06-13T23:12:13.451000+00:00
Original source
Let me give you the example of a class representing a color ```c++
struct RGBA
{
float r, g, b, a;
RGBA(float r, float g, float b, float a) r®, g(g), b(b), a(a) {};
// Add methods that make sense here
CYMK toCYMK() { /* ... */ };
};
```
The example is pretty minimal, and it's probably lacking a lot of things, but one of the things it's not lacking is getters and setters
Archived author: chipzz • Posted: 2024-06-13T23:18:45.480000+00:00
Original source
Sixth (or am I at 7 already? I think I'm starting to loose count), it was already said that this class is supposed to be an internal helper class. Which vastly reduces the amount of code it's exposed to. How many places do you think is going to check the interval? It probably shouldn't check the interval at all, but instead using the "Passed" method. But if, and that is a very big if, there's an actual need to check the interval, that would be in some kind of loop checking timers. It would and should be extremely localized, especially because this is supposed to be an internal helper class.
Archived author: chipzz • Posted: 2024-06-13T23:20:24.063000+00:00
Original source
IF you are checking the interval outside of the loop, that IMO is a red herring there's something wrong with your code in the first place. And I would rather have a red herring that tries to access the field directly than some "innocent looking" getter.