CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C++ DETAILS
Question :
What is a scope resolution operator?
Category C++ Interview Questions
Rating (4.0) By 39 users
Added on 10/22/2004
Views 7612
Rate it!
Answers:

A scope resolution operator (::), can be used to define the member functions of a class outside the
class.



when we want to define the member function of the same class but the definition is at outside the class...at that time we have to use scope resolution operator...



 Posted by: Chetan Lathigara    

Contact Chetan Lathigara  Contact Chetan Lathigara

you also use that operator to call a static member function by class name

class A
{
static void test()
{
cout<<"wellcome";
};
main()
{
A::test();
}
}



 Posted by: Essam Ali    

Contact Essam Ali  Contact Essam Ali

1.scope resolution operator is used to define the member function outside the class.
2.it is also used to print the value of global variable and local variable .
for example
int a=10;
void main()
{
int a=20;
cout<<a;
cout<<::a;
}
output
10 20





 Posted by: jaspreet singh phul    

Contact jaspreet singh phul  Contact jaspreet singh phul

*Scope Resolution Operator(::) is a new operator in C++
*It is used to local variables or called on the outside in a class



 Posted by: Bathrunisa    

Contact Bathrunisa  Contact Bathrunisa

Scope resolution operator tells the identifier (function or variable) belongs to perticular namespace or class.



 Posted by: Rahul Susar    

Contact Rahul Susar  Contact Rahul Susar

scope is nothing but the visibility of a variable or a member. The members declared in the class by default wil have the class scope. It gives us the information like to which particular class a member belongs to.



 Posted by: sistla laxmi    

Contact sistla laxmi  Contact sistla laxmi

.scope resolution is represented as "::"
.it is use for globel representation
.we use it for declaring a member function out of class
syntax:-
void get::data();
wear
void->returntype
get->classname
::->scope resolution
data->funtion name
par->agruments



 Posted by: P.ASHWINI    

Contact P.ASHWINI  Contact P.ASHWINI

scope resolution is a operator.it is used for classifying the function which is a part of that class.



 Posted by: adarsh shrivastava    

Contact adarsh shrivastava  Contact adarsh shrivastava

Scope resolution operator is used to access the global variable in a block where one of the local variable in that block have the same name as global variable.

int Num;
class A
{
public:
void Func()
{
int A =10;
::A =20;//Definition of Global Variable
}
};



 Posted by: Subeetha    

Contact Subeetha  Contact Subeetha


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What do you mean by inheritance?
View Answer
What is polymorphism? Explain with an example?
View Answer
What is the difference between an object and a class?
View Answer
What is encapsulation?
View Answer
What is abstraction?
View Answer
What do you mean by binding of data and functions?
View Answer
Difference between realloc() and free()?
View Answer
What is function overloading and operator overloading?
View Answer
What is virtual class and friend class?
View Answer
What do you mean by inline function?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C++ Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/953/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.62