2. The concept of polymorphism is implemented using the
overloaded function and operator.
The overloaded member function are selected for
invoking by matching arguments both type and number.
It is called binding or static binding or static linking.
Member function could be selected while the program
is run time is known as runtime polymorphism
4. Pointer is one of the key aspects of C++ language
similar to that of C.
Pointer is derived data type that refers to another data
variable by storing the variable memory address rather
than data.
A pointer variable defines to get the value of a specific
data variable of defining actual data.
6. The declaration of a pointer variable following form:
Example:
int *ptr;
Initialize a pointer:
int *ptr, a;
ptr=&a;
Data _type *pointer –
variable;
7. To manipulate a pointer with the indirect
operator “*” is known as dereference
operator
*pointer _variable
8. C++ allows pointers to perform the following arithmetic
operation:
1) A pointer can be incremented (++) or decremented (--).
2) Any integer can be added to subtracted from a pointer.
3) One pointer can be subtracted from another.
Example:
Int *aptr;
Ptr=&a[0];
9. The array of pointer represents a collection of
address.
An array of pointer point to an array of data
items.
Example:
int *in array[10];
11. The usage of pointer with one dimensional
array element.
A string is one dimensional array of character.
Example:
char num[]=“one”;
const char *numptr=“one”;
12. The concept of pointer to function acts as a base for
pointer to member.
Its known as callback function.
These function pointer to refer to a function.
Declaration :
Example:
int (* num_function(int x));
data _type (* function_name) ();
13. To access the class member.
To point to an object created by a class.
Define a pointer:
Item *it_ptr;
14. This is a pointer that point to the object for
which this function was called.
The pointer this acts as an implict argument to
all the member function.
Example:
Class ABC
{
int a;
…..
};
15. Pointer to object of a class are type –
compatible with pointer to object of a derived
class.
Pointer is object of derived class.
B *cptr; // pointer to class B type
variable
B b;// base object
D d;// derived object
Cptr=&b;// cptr points to object