Sample Widget

Operator in C++ :-

C++ supports all of the operators provided by 'c' language and additionaly following

: : Scope resolution operator : :* Pointer-to-member declarator .* Pointer-to-member opeator -->* Pointer to member operator new Memory allocation operator delete Memory release operator endl Line feed operator  :: Scope Resolution Operator (SRO): The Scope Resolution Operator is used for qualitying the scope of an entity.It takes the following general from :: Class Name If the scope name is not specified while using the Scope Resolution Operator its defaults to the global scope. #include int n=0; void main() { int n=20 { } int x=n; int n=30; cout<<"\n"< . p-->=20; // --> } ::* Pointer to member declaretor This operator is used for declering a pointer to the member of the class class sample { public: int x; }; void main() { int y; // variable int *p //pointer to integer p=&y; int sample::*q; //pointer to integer member of class sample } .* pointer to member operator(using object name) This operator is used to access the member of the class using an object name and a pointer to member. class sample { public: int x; }; void main() { sample s; //object int sample ::*p; // let 'p' point to 'x' data member of class 'sample' s.x=10; //correct or s.*p=10; //correct }

Visitors

About Me

I am working as computer teacher in Ambuja School