I'm translating some code, and in this completely unused private language, the code states that if more than 4 parameters were passed in (as the 5th parameter is optional), then do something to the value of that parameter, like so:
if (ParamCount > 4) {
if (ID == 0) {
ID = 0x700;
if (mtrx > 0) {ID = 0x11AA0FF0; }
}
BaseID = ID;
} else {
BaseID = ID;
}
How would I write this out in C++98? I created a constructor which takes in those parameters, as I am trying to turn this bit of code into a class, yet when a parameter is optional you have to set it a value, like 0, or so I thought.
Overload the function instead.
The version with 5 parameters uses the true part of the if.
The other version uses the false part of the if.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With