INST 201 Lecture Notes - Lecture 9: Semicolon
Document Summary
Classes are fundamental components of a c++ program. Like structs, introduced earlier, they group related information together. They are essentially new user-defined data types, but they can also contain member functions that operate on their data members. Here is the general syntax of a class specification: class myclass. // class followed by the name of the class. // that are visible only inside an object int val;// example of a data member public: // instance data 4. int a = newobject. get_val(); I have included above a few examples of functions defined outside of the braces that make up the rest of the class. This is typical for structuring the program if a function is more than just a line or two long. As an additional point, functions defined within the braces of the class definition are made inline by default.