HOW DOES ONE PASS AN ENUM TYPE AS A PARAMETER FOR A CONSTRUCTOR

Hi everyone, My class below contains two enum types. My problem is passing an enum parameter to the constructor. I'm not really sure how to do that.
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
#ifndef ENTERTAINMENT_H
#define ENTERTAINMENT_H
#include "film.h"
#include <QString>

class Entertainment : public Film
{
public:
    enum m_FilmType{Action, Comedy, Sci_Fi, Horror, Drama, Romance};
    enum MPAARatings{G, PG, PG_13, NSV16, NSV18};
    Entertainment(QString f_ID, QString f_Title,
                  QString f_Director, int f_Length, QDate ReleaseDate, m_FilmType Type, MPAARatings Rating);
    QString toString();
private:
    m_FilmType m_Type;
    MPAARatings m_Rating;
};

#endif // ENTERTAINMENT_H

#include "entertainment.h"

Entertainment::Entertainment(QString f_ID, QString f_Title,
                             QString f_Director, int f_Length, QDate ReleaseDate,
                             m_FilmType Type, MPAARatings Rating):Film(f_ID, f_Title, f_Director, f_Length, ReleaseDate)
{
    m_Type = Type;
    m_Rating = Rating;
}

QString Entertainment::toString()
{
    QSatring tempStr;
    QTextStream actualStr(&tempStr);

    actualStr <<Film::toString()<< " Movie Type: "<<m_Type<<" MPAARating: "<<m_Rating<<endl;

    return tempStr;
}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <QtCore/QCoreApplication>
#include <QDate>
#include "film.h"
#include "educational.h"
#include "entertainment.h"
#include "filmlist.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QDate date(QDate::currentDate());

    FilmList list;
    Entertainment movie_1("89564", "Apocalypto", "Mel Gibson", 2, date, ???);


    return a.exec();
}

Entertainment movie_1("89564", "Apocalypto", "Mel Gibson", 2, date, Entertainment::Whatever);
Topic archived. No new replies allowed.