Hi, I am trying to work with "enum" data types, and need some assistance

What I have is pretty Basic, but the method for getting these enumerated datatypes is a protected method within a class. What I am trying to accomplish is to use a getter() to return some data of type "the enumerated type". This will then be called by assignment to a vairable that is used in a switch block of code. Here are the parts of my code that pertain to the enum, any help would be appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//Global Decleration, that shows friendly akas for media types
enum MC_MEDIA_TYPE{ AUDIO_CASSETTE = 1, AUDIO_CD, VIDEO_VHS, VIDEO_DVD };

//Function prototypes listed from the public: area of my class
public:
   void AddMedia( );//user adds a media object to the collection

//Function prototypes listed from the protected: area of my class
protected:
   //prints Media type Menu
   void DisplayMediaTypeMenu( );

   //gets a friendly name for the type of media selected
   MC_MEDIA_TYPE GetMediaTypeSelection( );

//Implementation of the above prototypes
//user adds a media object to the collection
void MediaCollection::AddMedia( )
{
	MC_MEDIA_TYPE Selection;
	if( CurrentMCSize < MEDIA_COLLECTION_SIZE )
	{
		DisplayMediaTypeMenu( );
		Selection = GetMediaTypeSelection();
		switch( Selection )
		{
			case AUDIO_CASSETTE: //Collection[CurrentMCSize] = new AudioCassette;
				cout << "creat a cassette" << endl;
				break;

			case AUDIO_CD: //Collection[CurrentMCSize] = new AudioCD;
				cout << "create a cd" << endl;
				break;

			case VIDEO_DVD: //Collection[CurrentMCSize] = new VideoDVD;
				cout << "creat a dvd" << endl;
				break;

			case VIDEO_VHS: //Collection[CurrentMCSize] = new VideoVHS;
				cout << "create a vhs" << endl;
				break;

			default: cout << "\nInvalid selection\n\n";
		}//end switch block
	}
	else cout << "Media collection is full - cannot add another media item at this time." << endl;
             cout << "Please make room in your media storage by deleting something first." << endl;
}

//prints Media type Menu
void DisplayMediaTypeMenu( )
{
	cout << "\n|===============| Media Types |===============:" << endl;
	cout << "| 1) AUDIO_CASSETTE" << endl;
	cout << "| 2) AUDIO_CD" << endl;
	cout << "| 3) VIDEO_DVD" << endl;
	cout << "| 4) VIDEO_VHS" << endl;
	
}

//gets a friendly name for the type of media selected (This is protected)
MC_MEDIA_TYPE GetMediaTypeSelection( )
{
	MC_MEDIA_TYPE selection;
	cout << "\nSelect one of the following choices: " << endl;
	cin >> selection;
	return selection;
}

So this boils down to the the menu being displayed, then selection will call the function for the user to input their type selection and assign that value to itself so it can be passed on to the switch statements. I am having trouble getting the GetMediaTypeSelection to return the values I need based upon user input.
Topic archived. No new replies allowed.