Saturday, May 9, 2009

How can the scope resolution operator in c++ be replaced by anything else?

in c++, while implementing inheritance, scope resolution operator i.e. '::' is used to specify the visibilty mode of derived class.is there any replacement for this operator?(maybe some other operator or something else).if yes,then wat is the replacement?

How can the scope resolution operator in c++ be replaced by anything else?
Scope resolution operator "::" cannot be overloaded because it is a base address resolution operator. in C++, while implementing inheritance, redefinition of function is possible instead of using scope resolution operator.
Reply:There is no replacement for a scope resolution operation. The member functions and variables can be accessed using a class objective pointer but a scope resolution is needed to specify the relation between function of a class with other functions and classes.
Reply:just by using an accessed member at the end of class definition
Reply:I dont think any other operator is there to replace scope resolution operator.


In worst case, if u really any alternative, then u can overload any operator so that it function same as ' :: '. But this is never recommed option.


No comments:

Post a Comment