hi,
I am creating an api for a phonebook which has 3 different types of phone-numbers:FAX, HOME, WORK, CELL
I want to add a number to a specific type but do not want to classify FAX,HOME,WORK etc. as primitive types as I am considering that I could change it at a later date.
I was trying to use enums but am not clear how I can use it efficiently in this case.
The code I worked up till now for this part:
private enum NumberType{
FAX, WORK, HOME, CELL}
class PhoneNumber{
PhoneNumber(int Number, NumberType type){
this.number = Number;
this.type = type;
}
..
getter and setter for above
..
}
But I still do not get how I could assign a specific phoneNumber to a specific NumberType.
I am still confused. I want to make it easy for someone to use this feature.
Please help.
Thank you.