5.1 INTRODUCTION
Object-Oriented Programming (OOP) is primarily a game with classes. OOP involves modelling abstract objects as well as real life objects like, say, a student. Let us understand (study) the attributes of a student relevant to a programmer. A student has attributes like roll number, name and marks. These attributes become data members of the class. The functions for processing these data members (like getData and showResult) become member functions of the class. This way the project leader designs the required class named, say, Student.
(1) Class
A class is a software representation of an object (real life or abstract). In a programmer's words, it is a user-defined data type. Consider the declaration:
class Student{ private: int ...
Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.