On Thu, 2004-07-22 at 21:14, Rohit K Gupta wrote:
> Hi to all,
>  
> i was wondering about the fact that 
> as C++ provides for Operator Overloading and Friend Functions
> ,does C# Provide such functionality?
> Operator overloading is as its name implies
>     we can define operator functionalities for user defined classes
>  
> and friend functions are those which can be defined outside the class
> but declared friend to the user defined class so that it can access
> private memebers of the class.
>  
> now  by friend where i am confused  is 
> in C# we can define friend classes, members and  functions but those
> are part of class and can be accessed in same assembly only by making
> the instace of the class 
> whereas  the c++ friend function can be called without instace of
> object but just by passing it in arguments

Not too sure about the operator overloading, I know it can be done, I've
just never needed to do it myself. As far as 'friends' go, there is no
polymorphism in C#, so you are either a derived class or you are not.
'protected' elements are visible to derived classes, but not to calling
classes. 'public' is visible to all, 'private' is restricted to the
defining class and is not visible to derived classes.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to