Classes and Objects in Object Oriented Programming
shabbirzvohra
1 views
63 slides
Oct 31, 2025
Slide 1 of 63
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
About This Presentation
a brief breakdown on classes and objects in C++
Size: 2.93 MB
Language: en
Added: Oct 31, 2025
Slides: 63 pages
Slide Content
Chapter – 5 Classes and Objects
Classes & Objects
Using Class in C++ needs 3 steps to be followed Specify the class Declaration of class Defintion of member functions Create objects for the class Access the public members of the class using objects
Specifying a class
Creating Objects
Accessing the Members of the Class
Accessing the Members
Defining Member Functions
Member function definition Outside the class specification
Access Specifiers/Visibility Modes: C++ provides 3 types of Visibility Modes private public protected
Two objects of the class student
Client- Server model for message communication
Characteristics of Member Functions:
class marks { private : int roll; int ml,m2; public: void getdata(); void displaydata(); }; void marks: :getdata() { cout<<“enter the roll- no:”;cin>>roll; cout<<”enter 1st subject mark:”; cin>>ml; cout<<”enter 2nd subject mark:”; cin>>m2; } void marks: :displaydata() { cout<<“Roll No.”<<roll; cout<<”Ist subject mark:”<<ml<<endl ; cout<<”2nd subject mark:”<<m2; } Write a simple program using class in C++ to input subject mark and prints it.
void main() { clrscr(); marks x; x.getdata(); x.displaydata(); }
Nesting of Member Functions
Memory allocation for static member
Array of objects
REFERENCES: E. Balagurusamy, “Object Oriented Programming with C++”, Fourth edition, TMH, 2008. LECTURE NOTES ON Object Oriented Programming Using C++ by Dr. Subasish Mohapatra, Department of Computer Science and Application College of Engineering and Technology, Bhubaneswar Biju Patnaik University of Technology, Odisha K.R. Venugopal, Rajkumar, T. Ravishankar, “Mastering C++”, Tata McGraw-Hill Publishing Company Limited Object Oriented Programming With C++ - PowerPoint Presentation by Alok Kumar OOPs Programming Paradigm – PowerPoint Presentation by an Anonymous Author