Suppose I have a class Person with instance fields
I would like to assign an int value to all the instance fields, for example: name = 1, surname = 2, currentAge = 3. But this mustn't change the original value of a field.
Suppose class Person has a method
Then the output of print(1) should be Ted.
I was trying to do this with a switch sentence but since the fields are of different data type, I am now stuck. Could you think of any elegant solution?