Page 10 - DCAP404 _Object Oriented Programming
P. 10
Unit 1: Review of Object-oriented Programming
2. Classes: A class represents a set of related objects. The object has some attributes, whose Notes
value consist much of the state of an object. The class of an object defines what attributes an
object has. The entire set of data and code of an object can be made a user-defined data type
with the help of a class.
Classes are user defined data types that behave like the built-in types of a programming
language. Classes have an interface that defines which part of an object of a class can be
accessed from outside and how. A class body that implements the operations in the interface,
and the instance variables that contain the state of an object of that class.
The data and the operation of a class can be declared as one of the three types:
(a) Public: These are declarations that are accessible from outside the class to anyone
who can access an object of this class.
(b) Protected: These are declarations that are accessible from outside the class to anyone
who can access an object of this class.
(c) Private: These are declarations that are accessible only from within the class itself.
Figure 1.2: Property Inheritance
LOVELY PROFESSIONAL UNIVERSITY 3