[Mono-list] C# Functionality
Thu, 22 Jul 2004 21:53:10 -0700
On Thu, 2004-07-22 at 21:14, Rohit K Gupta wrote:
> Hi to all,
> 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
> 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=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.
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)
-----END PGP SIGNATURE-----