Как реализовать это на C++?
Вот код Java:
Код: Выделить всё
enum EquationType {
LINE("LINE"), LINE3D("LINE3D"), BEZIER("BEZIER"), PLANE("PLANE");
EquationType(String curve_type) {
type = curve_type;
} //END: CurveType()
String type; // enum's member variable that store symbolic name of type (for utilite using)
public String get_type_string() {
return type;
} //END: get_type_string()
public static EquationType _bystring(String type) throws Exception {
for (EquationType value : values()) { // search by list of enum's values
if (value.get_type_string().equals(type.trim().toUpperCase())) {
return value;
}
}
} //END: _bystring()
} //END: enum EquationType
Есть ли какой-нибудь аналог в C++?
Подробнее здесь: https://stackoverflow.com/questions/601 ... enums-in-c
Мобильная версия