✔ C++ CHAPTERS:-
1. CPP-Introduction
2. CPP-OOPs Concepts
3. CPP-Statements
4. CPP-Programming Examples
5. CPP-Operators
6. CPP-Functions
7. CPP-Classes & Objects
8. CPP-Array Of Objects
9. CPP-Constructors
10. CPP-Destructors
11. CPP-Inheritance
12. CPP-Multiple Inheritance
13. CPP Hierarchical Inheritance
14. CPP-Important Points
1. CPP-Introduction
2. CPP-OOPs Concepts
3. CPP-Statements
4. CPP-Programming Examples
5. CPP-Operators
6. CPP-Functions
7. CPP-Classes & Objects
8. CPP-Array Of Objects
9. CPP-Constructors
10. CPP-Destructors
11. CPP-Inheritance
12. CPP-Multiple Inheritance
13. CPP Hierarchical Inheritance
14. CPP-Important Points
But CPP also provides some different operators from C.
- [::] scope resolution operator.
- [delete] memory release operator.
- [endl] line feed operator.
- [new] memory allocation
- [setw] field width operator
1. Scope resolution operator :
- The notation of scope resolution is :: .
- This operator is used for two purposes:
- This operator tells compiler that the specified function belongs to which class or we can define the definition of member function at outside the class.
Syntax :
Classname ::functionname( )
This operator is used to access the global variable.
Classname ::functionname( )
This operator is used to access the global variable.
For eg:
intabc;
void main( )
{
void func( );
abc=1;
cout<<” value of abc is = ”<
func( );
}
void func( )
{
intabc;
abc=4;
::abc++;
cout<<”local variable is =”<
cout<<”global variable is=”<<::abc span="">
}
2. Memory release operator and 4. Memory allocation :- Both memory allocation and release operator is known as memory management operator which are used to allocate or deallocate memory occupied by the object.
- For memory allocation ‘new’ is used.
- Syntax :
Pointer_variable = new datatype;
Eg :
int *ptr;
ptr=new int;
- ‘new’ keyword can be used to create a memory space for arrays ,classes and structure also.
Eg:
int * array_pointer = new int[2][3];
- For deallocation the memory occupied by new operator delete operator is used.
- Syntax :
delete pointer_variable;
Eg:
delete ptr;
3. Line feed operator and 5. Field width operator (setw):- The line feed and field width operators are known as manupilators.
- The line feed operator (endl) and field width (setw) are used to set the format of displayed data.
- endl is used to insert a new line.
For eg:
cout<<”my name is Seeta“<
cout<<”I live in Rajasthan”;
output :
my name is Seeta
I live in Rajasthan
5. setw:
It is used to specifies a field width for printing value of a variable and also knwown as field width operator.
syntax :
setw(width);