[Mono-list] C# Functionality

Richard Thombs stony@stony.org
Thu, 22 Jul 2004 21:53:10 -0700


--=-15DXpdRKhvxo2K8cYif/
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Thu, 2004-07-22 at 21:14, Rohit K Gupta wrote:
> Hi to all,
> =20
> i was wondering about the fact that=20
> 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
> =20
> 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.
> =20
> now  by friend where i am confused  is=20
> 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=20
> 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.


--=-15DXpdRKhvxo2K8cYif/
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBBAJm2QX6Fef4Vv7ERAmz5AJ92Z76S1HfNpXczxLxGQKhkC22pXgCgu7Bx
45GkcDl+LSsH8pGlGcwanLg=
=Lbo4
-----END PGP SIGNATURE-----

--=-15DXpdRKhvxo2K8cYif/--