jeudi 30 avril 2020

Evaluating the constructor equivalent of a variable

I have the constructor

class MyFrame : public wxFrame {  // defines the options on the top bar of the screen here we have:
    public:
        MyFrame();
    private:
        void OnHello(wxCommandEvent& event);  // hello option
        void OnExit(wxCommandEvent& event);  // exit option
        void OnAbout(wxCommandEvent& event);  // about option
        void OnHelp(wxCommandEvent& event); // event option

        // void OnCourseTextBoxClicked(wxCommandEvent &event);
        void OnOneHundredLevelDisplayGpButtonClicked(wxCommandEvent &event);
        void OnTwoHundredLevelDisplayGpButtonClicked(wxCommandEvent &event);
        void OnThreeHundredLevelDisplayGpButtonClicked(wxCommandEvent &event);
        void OnFourHundredLevelDisplayGpButtonClicked(wxCommandEvent &event);
        void OnFiveHundredLevelDisplayGpButtonClicked(wxCommandEvent &event);

        void OnDisplayCgpaButtonClicked(wxCommandEvent &event);

        // Common Courses equating their credit load
        /* 100 LEVEL FIRST SEMESTER */
        int CHM111 = 3;
        int CHM113 = 3;
        int MTH111 = 3;
        int MTH112 = 3;
        int PHY111 = 3;
        int PHY113 = 3;
        int GST111 = 2;
        int GST112 = 2;

        /* 100 LEVEL SECOND SEMESTER */
        int CHM122 = 3;
        int CHM124 = 3;
        int MTH123 = 3;
        int MTH125 = 3;
        int PHY109 = 2;
        int PHY124 = 4;
        int GST121 = 2;
        int GST122 = 2;
        int GST123 = 2;
        int LEVEL_TOTAL_100 = 47;
}

And somewhere else in the code base, some text is entered into a text box. The text box is supposed to contain one of the variables defined in the constructor which evaluate to their respective integers.

When the text box's content is evaluated e.g.:

course_one_text_box->GetValue();

evaluates CHM111

I want to grab the constructor integer value for the CHM111 which is 3. I want to employ this value in a mathematical formula.

How do I do this? Is there a particular syntax that grabs the constructor recorded version of the variable instead? Thanks.

Aucun commentaire:

Enregistrer un commentaire