KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to learn how to initialize lists. I have a simple class below and trying to initialize the list of variables. The first Month(int m): month(m) works. I'm trying to do something similar below that line with more than one variable. Is this possible in that format? would I have to break away from the one liner? class Month { public: Month(int m) : month(m) {} //this works Month(char first, char second, char third) : first(first){} : second(second){} : third(third){} //DOES NOT WORK Month(); void outputMonthNumber(); //void function that takes no parameters void outputMonthLetters(); //void function that takes no parameters private: int month; char first; char second; char third; }; Obviously I don't have much clue how to do this, any guidance would be appreciated, thanks
Tags (comma-separated)
Save Edits
Cancel