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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access