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

Group5

Uploaded by

pawarnisha1797
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)
3 views

Group5

Uploaded by

pawarnisha1797
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/ 11

Maharashtra State Board Technical Education

P.E.S POLYTECHNIC AURANGABAD


Computer Engineering Department
Academic year :2024-2025

Topic of seminar : Class and Object in C++

Academic year :2024-2025 Presented by:


Topic of seminar : Class and 1. Siddique Yaser
Object C++ 2. Abdul Raqeeb Khilji
Guided by : prof. Nisha 3. Shaikh Abdal
pawar ma’am
Index
• Introduction to Classes and Objects
• Specifying a class
• Access Specifiers
• Defining Member Function : Inside And Outside
Class
• Creating Object
• Memory allocations for objects
Introduction to`1
Classes And Objects
 A Class is a important data type in object
oriented programming language [OOP] and it is
defined as a kind of a blueprint or template that
refers to the methods and attributes that will be
in each object.

 A Class provides the blueprints for object, so


basically an object is created from a class,
object can be called as instance of a class.
Specifying a Class
 A class is defined in C++ using keyword class followed by the
name of class. The body of class is defined inside the curly
brackets and terminated by a semicolon at the end.
Access Specifiers
 Access specifiers define how the members
(attributes and methods) of a class can be
accessed.
 In C++, there are three access specifiers:

 public - members are accessible from outside the


class.
 private
- members cannot be accessed (or viewed)
from outside the class
 protected - members cannot be accessed from
outside the class, however, they can be accessed in
inherited classes.
Defining Member Function
Inside A Class
 Inside Class Definition
 The member function is defined inside the class
definition it can be defined directly.
 Syntax:
Class Class_name {
public:
return_type method_name() // method inside
class definition
{
//body of member function
}
};
Defining Member Function


Outside A Class
The member function is defined outside the class
definition it can be defined using the
scope resolution operator(::).
 Syntax:
 Class Class_name {
public:
return_type method_name(); // method
outside class definition
}; // Outside the class using scope resolution
operator
Return_type Class_name :: method_name() {
//body of member function
}
Creating Object

 We can create an object of the given


class in the same way we declare the
variables of any other inbuilt data
type.

Class_Name Object_Name;

 Example:
 Demo_Class Obj;
Memory Allocations For
Objects

 The way memory is allocated to variables and functions of


the class is different even though they both are from the
same class. The memory is only allocated to the variables
of the class when the object is created.
Block Logical Diagram for
Object Memory
Management
THANK YOU

You might also like