0% found this document useful (0 votes)
68 views

"Objects and Classes": Seminar On

The document summarizes a seminar on objects and classes presented by Abhishek Totad under the guidance of Prof. G. B. Chittapur. It defines key concepts of object-oriented programming including objects, classes, class members, and accessing data members. It provides an example class definition for class A with data members and member functions. It also discusses private, public, and protected access specifiers and provides a code example demonstrating accessing private class data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

"Objects and Classes": Seminar On

The document summarizes a seminar on objects and classes presented by Abhishek Totad under the guidance of Prof. G. B. Chittapur. It defines key concepts of object-oriented programming including objects, classes, class members, and accessing data members. It provides an example class definition for class A with data members and member functions. It also discusses private, public, and protected access specifiers and provides a code example demonstrating accessing private class data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Seminar On

“Objects and Classes”

Presented by Under The Guidance


Abhishek Totad Prof. G . B . Chittapur
(USN:2BA18MCA01)
 Object Oriented Programming.
 Object.
 Classes
 Definition class.
 Class members.
 Accessing the Data Members.
 Example.
 Conclusion
Object Oriented Programming

 Object Oriented programming is a programming style that is


associated with the concept of Class, Objects and various
other concepts revolving around these two, like Inheritance,
Polymorphism, Abstraction, Encapsulation etc.
Object
 Any entity that has state and behavior is known as an object.
For example: chair, pen, table, keyboard, bike etc.
 It can be physical and logical.
 Object is a runtime entity, it is created at runtime.
Example:-
Student s1;  //creating an object of Student 
Classes
 A class is an abstract data type similar to 'C structure'.
 The Class representation of objects and the sets of operations
that can be applied to such objects.
 The class consists of Data members and methods.
Definition of a class

Syntax:
Class class_name {
Data Members;
Methods;
}
Class Members
 Data and functions are members.
 Data Members and methods must be declared within the class
definition.
 A member cannot be redeclared within a class.
 No member can be added elsewhere other than in the class
definition
Example
Class A

{
int i;
int j;
void f (int, int);
int g();
}
// j is a data member of class A
// j is a data member of class A

f and g are a member function of class A. They determine the

behavior of the objects of class A.


Accessing the Data Members
 Private
The private keyword makes data and functions private. Private
data and functions can be accessed only from inside the same
class.
 Public
The public keyword makes data and functions public. Public
data and functions can be accessed out of the class.
 Protected 
members are accessible from other members of the same class
(or from their "friends"), but also from members of their
derived classes.
Example
#include <iostream> int main()
{
using namespace std;
Test o1, o2;
class Test {
float secondDataOfObject2;
private: o1.insertIntegerData(12);
int data1; float data2; secondDataOfObject2 = o2.insertFloatData();

public: cout << "You entered " <<


secondDataOfObject2;
void insertIntegerData(int d) {
return 0;
data1 = d;
}
cout << "Number: " << data1; Output

} Number: 12
Enter data: 23.3
float insertFloatData() { You entered 23.3

cout << "\nEnter data: ";

cin >> data2;

return data2;

} };
Allocate memory for objects.

 Int :- 2Bytes
 Char :- 1Bytes
 Float :- 4Bytes
 Double :- 8
Object-oriented programming (OOP) is a computer
programming that uses objects, data structures that consists of
methods and data fields with their interactions to design
computer programs and applications. This technique includes
many features like
data abstraction, encapsulation, polymorphism, and
inheritance.
Thank You

You might also like