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

pointer-to-object-.pptx

  • 1.
    CONTENTS â€ĸ Pointer. â€ĸ Explanationof Class. â€ĸ Explaination of Object. â€ĸ Referencing Operator & Dereferencing Operator. â€ĸ Program Explanation. â€ĸ Explaination of Pointer to Object. POINTER
  • 2.
    â€ĸ CLASS # AClass 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 # Anobject 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 toObject # 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 # Pointeris 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
  • 8.