PDF Archive

Easily share your PDF documents with your contacts, on the Web and Social Networks.

Send a file File manager PDF Toolbox Search Help Contact



ObjectOrientedProgrammingUnit2.pdf


Preview of PDF document objectorientedprogrammingunit2.pdf

Page 1 2 3 4 5 6 7 8 9 10

Text preview


Object Oriented Programming with C++

10CS36

UNIT II
CLASSES AND OBJECTS – I

Topics covered

Classes & Objects – I: Class Specification, Class Objects, Scope resolution operator,
Access members, Defining member functions, Data hiding, Constructors, Destructors,
Parameterized constructors, Static data members, Functions

UNIT-2 Summary
In C++, the class forms the basis for object-oriented programming. The class is
used to define the nature of an object, and it is C++'s basic unit of
encapsulation. This chapter examines classes and objects in detail.
1. Class Specification
Classes are created using the keyword class. A class declaration
defines a new type that links code and data. This new type is then used to
declare objects of that class. Thus, a class is a logical abstraction, but an
object has physical existence. In other words, an object is an instance of a
class.
A class declaration is similar syntactically to a structure. a
simplified general form of a class declaration was shown. Here is the entire
general form of a class declaration that does not inherit any other class.
class class-name {
private data and functions
access-specifier:
data and functions
access-specifier:
data and functions
// ...
access-specifier:
data and functions
Page 27