SlideShare a Scribd company logo
CONTENTS
• Pointer.
• Explanation of Class.
• Explaination of Object.
• Referencing Operator & Dereferencing Operator.
• Program Explanation.
• Explaination of Pointer to Object.
POINTER
• CLASS
# A Class is a user defined data type which has data
member & member functions.
# It is declared by using keyword “Class”.
# Syntax :
Class class_name
{
access specifier :
data members;
member function ()
};
# Example:
Class car
{
private :
int spd lmt ;
int inc.spd ;
};
• Object
# An object is an instance(occurence) of a class, when a class is
defined no memory is allocated but when object is created memory is
allocated.
# Syntax:
Class_name obj_name;
# Example:
Class student
{
private :
int roll;
char name [10];
public :
void getdata ()
void putdata ()
};
• Pointer to Object
# Just like other pointers, the object pointers are declared by placing in front
of a object pointer’s name.
# Syntax :
class_name * object_pointer_name;
# Eg.
date * ptr;
# To access the public members using an object Dot ( . ) operator is used,
and to access public membes using object pointer, the arrow ( -> ) operator
is used
• Pointers
# Pointer is a vaiable which is used to store memory address of another
variable.
# Pointer is basically derived data type of C++.
# Declaration of Pointer
Syntax:
data_type * variable_name;
Eg.
1. int * ptr;
2. float * ptr;
3. char * ptr;
REFERENCING OPERATOR & DEREFERENCING OPERATOR
1) Address of Operator (Reference operator &) :-
Syntax-
&variable name
e.g P=&X;
2) Dereferencing Operator ( Value of Operator * ):-
e.g y=*p;
Program Referencing & Dereferencing
THANKS

More Related Content

What's hot

Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and DestructorKamal Acharya
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Amit Soni (CTFL)
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
Dhrumil Panchal
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
Vineeta Garg
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
 
Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
Dr.Neeraj Kumar Pandey
 
Methods in java
Methods in javaMethods in java
Methods in java
chauhankapil
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
 
Polymorphism in C++
Polymorphism in C++Polymorphism in C++
Polymorphism in C++
Rabin BK
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
RahulAnanda1
 
constructors in java ppt
constructors in java pptconstructors in java ppt
constructors in java ppt
kunal kishore
 
Pointers,virtual functions and polymorphism cpp
Pointers,virtual functions and polymorphism cppPointers,virtual functions and polymorphism cpp
Pointers,virtual functions and polymorphism cpp
rajshreemuthiah
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
International Islamic University
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
Burhan Ahmed
 
Files and streams
Files and streamsFiles and streams
Files and streams
Pranali Chaudhari
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ pptKumar
 

What's hot (20)

Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
File handling in c++
File handling in c++File handling in c++
File handling in c++
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
 
Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
 
Methods in java
Methods in javaMethods in java
Methods in java
 
Vectors in Java
Vectors in JavaVectors in Java
Vectors in Java
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
Polymorphism in C++
Polymorphism in C++Polymorphism in C++
Polymorphism in C++
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
constructors in java ppt
constructors in java pptconstructors in java ppt
constructors in java ppt
 
Pointers,virtual functions and polymorphism cpp
Pointers,virtual functions and polymorphism cppPointers,virtual functions and polymorphism cpp
Pointers,virtual functions and polymorphism cpp
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Files and streams
Files and streamsFiles and streams
Files and streams
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
 

Similar to pointer-to-object-.pptx

C++ppt. Classs and object, class and object
C++ppt. Classs and object, class and objectC++ppt. Classs and object, class and object
C++ppt. Classs and object, class and object
secondakay
 
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
Abdullah Jan
 
Classes, objects and methods
Classes, objects and methodsClasses, objects and methods
Classes, objects and methodsfarhan amjad
 
Class and objects
Class and objectsClass and objects
Class and objects
nafisa rahman
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
anitashinde33
 
oopm 2.pdf
oopm 2.pdfoopm 2.pdf
oopm 2.pdf
jayeshsoni49
 
Object Oriented Programming using C++ - Part 2
Object Oriented Programming using C++ - Part 2Object Oriented Programming using C++ - Part 2
Object Oriented Programming using C++ - Part 2
University College of Engineering Kakinada, JNTUK - Kakinada, India
 
OOP Unit 2 - Classes and Object
OOP Unit 2 - Classes and ObjectOOP Unit 2 - Classes and Object
OOP Unit 2 - Classes and Object
dkpawar
 
Android App code starter
Android App code starterAndroid App code starter
Android App code starter
FatimaYousif11
 
Class object
Class objectClass object
Class object
Dr. Anand Bihari
 
Object and class presentation
Object and class presentationObject and class presentation
Object and class presentation
nafisa rahman
 
C++ training
C++ training C++ training
C++ training
PL Sharma
 
Lecture 4. mte 407
Lecture 4. mte 407Lecture 4. mte 407
Lecture 4. mte 407
rumanatasnim415
 
Lecture 2 (1)
Lecture 2 (1)Lecture 2 (1)
Lecture 2 (1)
zahid khan
 
Presentation on class and object in Object Oriented programming.
Presentation on class and object in Object Oriented programming.Presentation on class and object in Object Oriented programming.
Presentation on class and object in Object Oriented programming.
Enam Khan
 
C++ And Object in lecture3
C++  And Object in lecture3C++  And Object in lecture3
C++ And Object in lecture3
UniSoftCorner Pvt Ltd India.
 
oop 3.pptx
oop 3.pptxoop 3.pptx
oop 3.pptx
OsamaMuhammad18
 

Similar to pointer-to-object-.pptx (20)

C++ppt. Classs and object, class and object
C++ppt. Classs and object, class and objectC++ppt. Classs and object, class and object
C++ppt. Classs and object, class and object
 
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
 
Classes, objects and methods
Classes, objects and methodsClasses, objects and methods
Classes, objects and methods
 
Class and objects
Class and objectsClass and objects
Class and objects
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
 
oopm 2.pdf
oopm 2.pdfoopm 2.pdf
oopm 2.pdf
 
Object Oriented Programming using C++ - Part 2
Object Oriented Programming using C++ - Part 2Object Oriented Programming using C++ - Part 2
Object Oriented Programming using C++ - Part 2
 
OOP Unit 2 - Classes and Object
OOP Unit 2 - Classes and ObjectOOP Unit 2 - Classes and Object
OOP Unit 2 - Classes and Object
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Android App code starter
Android App code starterAndroid App code starter
Android App code starter
 
Class object
Class objectClass object
Class object
 
Object and class presentation
Object and class presentationObject and class presentation
Object and class presentation
 
C++ training
C++ training C++ training
C++ training
 
Lecture 4. mte 407
Lecture 4. mte 407Lecture 4. mte 407
Lecture 4. mte 407
 
Lecture 2 (1)
Lecture 2 (1)Lecture 2 (1)
Lecture 2 (1)
 
Presentation on class and object in Object Oriented programming.
Presentation on class and object in Object Oriented programming.Presentation on class and object in Object Oriented programming.
Presentation on class and object in Object Oriented programming.
 
C++ And Object in lecture3
C++  And Object in lecture3C++  And Object in lecture3
C++ And Object in lecture3
 
oop 3.pptx
oop 3.pptxoop 3.pptx
oop 3.pptx
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 

More from ZaibunnisaMalik1

Chp1.3.pptx
Chp1.3.pptxChp1.3.pptx
Chp1.3.pptx
ZaibunnisaMalik1
 
Inner Pages 2022_merged (1).pdf
Inner Pages 2022_merged (1).pdfInner Pages 2022_merged (1).pdf
Inner Pages 2022_merged (1).pdf
ZaibunnisaMalik1
 
Faculty of Science.pdf
Faculty of Science.pdfFaculty of Science.pdf
Faculty of Science.pdf
ZaibunnisaMalik1
 
Hadiths of Prophet Mohammed SAW for Campaign.docx
Hadiths of Prophet Mohammed SAW for Campaign.docxHadiths of Prophet Mohammed SAW for Campaign.docx
Hadiths of Prophet Mohammed SAW for Campaign.docx
ZaibunnisaMalik1
 
struct.pptx
struct.pptxstruct.pptx
struct.pptx
ZaibunnisaMalik1
 
CPointer-hk.ppt
CPointer-hk.pptCPointer-hk.ppt
CPointer-hk.ppt
ZaibunnisaMalik1
 
user-definedfunctions-converted.pptx
user-definedfunctions-converted.pptxuser-definedfunctions-converted.pptx
user-definedfunctions-converted.pptx
ZaibunnisaMalik1
 

More from ZaibunnisaMalik1 (9)

Chp1.3.pptx
Chp1.3.pptxChp1.3.pptx
Chp1.3.pptx
 
Inner Pages 2022_merged (1).pdf
Inner Pages 2022_merged (1).pdfInner Pages 2022_merged (1).pdf
Inner Pages 2022_merged (1).pdf
 
Faculty of Science.pdf
Faculty of Science.pdfFaculty of Science.pdf
Faculty of Science.pdf
 
Hadiths of Prophet Mohammed SAW for Campaign.docx
Hadiths of Prophet Mohammed SAW for Campaign.docxHadiths of Prophet Mohammed SAW for Campaign.docx
Hadiths of Prophet Mohammed SAW for Campaign.docx
 
bab3c.ppt
bab3c.pptbab3c.ppt
bab3c.ppt
 
sav_ch09.ppt
sav_ch09.pptsav_ch09.ppt
sav_ch09.ppt
 
struct.pptx
struct.pptxstruct.pptx
struct.pptx
 
CPointer-hk.ppt
CPointer-hk.pptCPointer-hk.ppt
CPointer-hk.ppt
 
user-definedfunctions-converted.pptx
user-definedfunctions-converted.pptxuser-definedfunctions-converted.pptx
user-definedfunctions-converted.pptx
 

Recently uploaded

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 

Recently uploaded (20)

Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 

pointer-to-object-.pptx

  • 1. CONTENTS • Pointer. • Explanation of Class. • Explaination of Object. • Referencing Operator & Dereferencing Operator. • Program Explanation. • Explaination of Pointer to Object. POINTER
  • 2. • CLASS # A Class is a user defined data type which has data member & member functions. # It is declared by using keyword “Class”. # Syntax : Class class_name { access specifier : data members; member function () }; # Example: Class car { private : int spd lmt ; int inc.spd ; };
  • 3. • Object # An object is an instance(occurence) of a class, when a class is defined no memory is allocated but when object is created memory is allocated. # Syntax: Class_name obj_name; # Example: Class student { private : int roll; char name [10]; public : void getdata () void putdata () };
  • 4. • Pointer to Object # Just like other pointers, the object pointers are declared by placing in front of a object pointer’s name. # Syntax : class_name * object_pointer_name; # Eg. date * ptr; # To access the public members using an object Dot ( . ) operator is used, and to access public membes using object pointer, the arrow ( -> ) operator is used
  • 5. • Pointers # Pointer is a vaiable which is used to store memory address of another variable. # Pointer is basically derived data type of C++. # Declaration of Pointer Syntax: data_type * variable_name; Eg. 1. int * ptr; 2. float * ptr; 3. char * ptr;
  • 6. REFERENCING OPERATOR & DEREFERENCING OPERATOR 1) Address of Operator (Reference operator &) :- Syntax- &variable name e.g P=&X; 2) Dereferencing Operator ( Value of Operator * ):- e.g y=*p;
  • 7. Program Referencing & Dereferencing