Sunday, July 12, 2009

What are static classes in c# and what is friend keyword in c# ?why it is used?

what is .NET Frame work?is it same for all three packages(vb,asp %26amp; c#)

What are static classes in c# and what is friend keyword in c# ?why it is used?
A static class is a class that is allocated once when the program or dll loads, and stays in memory until the program closes. All of its members and functions must be static as well, and they are accessed using the class name, for example:





public static class MyStaticClass


{


int MyStaticInt;


}





You can get access to MyStaticInt anywhere by using 'MyStaticClass.MyStaticInt'.





I don't think C# has a friend keyword (if it does I'll be mad, because I was trying to use it and it didn't work) but basically friend allows certain specified classes access to private or protected members of a class.





The .net framework is a huge managed code library wrapper that sits on top of the Windows API. Any language that targets the .net framework will work the same, regardless of the language used to target it (so C#, VB.net and C++/CLI are all using the same underlying code objects in the .net framework).

morning glory

No comments:

Post a Comment