[Mono-list] C# Functionality
Jérôme Laban
jlaban@wanadoo.fr
Fri, 23 Jul 2004 19:53:32 +0200
> -----Original Message-----
> From: mono-list-admin@lists.ximian.com
> [mailto:mono-list-admin@lists.ximian.com] On Behalf Of Richard Thombs
> Sent: vendredi 23 juillet 2004 06:53
> To: Rohit K Gupta
> Cc: MONO
> Subject: Re: [Mono-list] C# Functionality
>
> 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.
There is polymorphism in C# and in .NET in general. I think you are misusing
the word and maybe you wanted to say multiple inheritance, which is not
available in .NET thus in C#. Multiple interface implementation is allowed,
though.
C# cannot define friend elements and allows static operator overloading
(compared to instance operator overloading that can be found in C++).
--
Jérôme Laban
{Epitech.}