P
Philipp Kraus
Hello,
I' writing a class with a method, that should get a parameter for
comparision like <, <=, > or >=. The method must compare some float
values but the user of the method should be set the comparision. My
first idea is to use an enum with 4 states of comparision, but is there
a better solution?
In pseudocode:
myclass::mymethod( comparision_operator p_comp ) {
float a,b;
if ( p_comp(a,b))
do something
}
Thx
Phil
I' writing a class with a method, that should get a parameter for
comparision like <, <=, > or >=. The method must compare some float
values but the user of the method should be set the comparision. My
first idea is to use an enum with 4 states of comparision, but is there
a better solution?
In pseudocode:
myclass::mymethod( comparision_operator p_comp ) {
float a,b;
if ( p_comp(a,b))
do something
}
Thx
Phil