public class Person { // Field public string name; // Constructor public Person() { name = "unknown"; } // Method public void SetName(string newName) { name = newName; } } class TestPerson { static void Main() { Person person = new Person(); Console.WriteLine(person.name); person.SetName("John Smith"); Console.WriteLine(person.name); // Keep the console window open in debug mode. Console.WriteLine("Press any key to exit."); Console.ReadKey(); } }
All the question that scared me now i am trying to scare them .. so that they cant scare others :)
Tuesday, June 28, 2011
Classes (C# Programming)
Subscribe to:
Post Comments (Atom)
Featured Posts
How to Auto-Terminate Frozen and Hung Apps in Windows
We have all been there. You are in the middle of an important project or a gaming session, and suddenly, your screen freezes. The dreaded ...
-
public struct CoOrds { public int x, y; public CoOrds( int p1, int p2) { x = p1; y = p2; } }
-
Manage timer jobs You can check the status of a timer job and edit the timer job definition. For the general administration of ...
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......