Engineering Science 1036A/B Lecture Notes - Lecture 8: Object-Oriented Programming, Global Variable, Memory Management
Document Summary
A class is a mechanism that allows a programmer to define new data types by following the object oriented programming principles. To add functionality to an existing data type or. A class definition combines data and functionality. Data members and function members are declared here. We can not initialize any data members here. Also included in the body of a class is a member access privilege label. When a class contains function members, we need to define those functions before we use the class to create a new data type. In general, defining the member functions of a class is known as. The member functions can be defined within the class declaration segment, and in this case, it is called in-line declaration as shown below: An object is a variable of a defined class type, also referred to as an instance of a class. Example: if student" is a class then objects can be declared as: