R
Robin Wenger
Internally in a class I would like to store a value as integer value.
From outside of the class this value should be accessible as enumeration.
I am thinking about something like:
pubic class mycontainer {
....
private int myvalue;
public enum weekday { monday, tuesday, wednesday };
public weekday getcurrentweekday() {
return(positioninlist(myvalue)); }
public void setcurrentweekday(weekday) {
myvalue=positioninlist(weekday);
}
}
In the sample above 1 should be assigned to myvalue if monday is set as weekday:
mycontainer.setcurrentweekday(mycontainer.weekday.monday);
However the core function positioninlist() is not available.
How can I achive this otherwise in detail?
Robin
From outside of the class this value should be accessible as enumeration.
I am thinking about something like:
pubic class mycontainer {
....
private int myvalue;
public enum weekday { monday, tuesday, wednesday };
public weekday getcurrentweekday() {
return(positioninlist(myvalue)); }
public void setcurrentweekday(weekday) {
myvalue=positioninlist(weekday);
}
}
In the sample above 1 should be assigned to myvalue if monday is set as weekday:
mycontainer.setcurrentweekday(mycontainer.weekday.monday);
However the core function positioninlist() is not available.
How can I achive this otherwise in detail?
Robin