var class1 = {
GetImportantValue: () => 1
};
var class2 = {
GetImportantValue: () => 2
};
var class3 = {
GetImportantValue: () => 3
};
var class4 = {
GetImportantValue: () => 4
};
var class5 = {
GetImportantValue: () => 5
};
function GetImportantValue1() {
return 1;
}
function GetImportantValue2() {
return 2;
}
function GetImportantValue3() {
return 3;
}
function GetImportantValue4() {
return 4;
}
function GetImportantValue5() {
return 5;
}
getImportantValueSwitch = (myClassEnum) => {
switch (myClassEnum.type) {
case 'MyClass1':
return GetImportantValue1();
case 'MyClass2':
return GetImportantValue2();
case 'MyClass3':
return GetImportantValue3();
case 'MyClass4':
return GetImportantValue4();
case 'MyClass5':
return GetImportantValue5();
}
}
getImportantValuePolymorphism = (myClass) => myClass.GetImportantValue();