Implementing OOPs is not a necessity of programming it is a style of
Programming......to make objects reusable.
On Tue, Sep 16, 2008 at 12:35 AM, VIKAS GARG <[EMAIL PROTECTED]>wrote:
> What is diffrence in these two programs
>
>
> First Type
>
> using System;
> class MyClass
> {
> private static int x;
> public static int X
> {
> get
> {
> return x;
> }
> set
> {
> x = value;
> }
> }
> }
> class MyClient
> {
> public static void Main()
> {
> MyClass.X = 10;
> int xVal = MyClass.X;
> Console.WriteLine(xVal);//Displays 10
> Console.ReadKey();
> }
> }
>
>
>
>
>
>
>
> Second Type
>
> using System;
> class MyClass
> {
> private static int x;
> /*public static int X
> {
> get
> {
> return x;
> }
> set
> {
> x = value;
> }
> }*/
> }
> class MyClient
> {
> public static void Main()
> {
> //MyClass.X = 10;
> int xVal = 10;
> Console.WriteLine(xVal);//Displays 10
> Console.ReadKey();
> }
> }
>
>
>
> Both gives the same result
> How we use the properties in C#
> What is its use
> When we can do any tasks without using properties then why we use
> properties
> Here in my first progg I have created private variable and still able to
> work on my progg
> Please reply
> I am having big confusion in these
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---