0% found this document useful (0 votes)
5 views1 page

Class, Object and Method

The document outlines a simple C# program that demonstrates the creation of a class, methods, and an object. It includes a 'Main' method that instantiates the class and calls both a public and a private method. The program prints messages to the console to illustrate the functionality of these methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Class, Object and Method

The document outlines a simple C# program that demonstrates the creation of a class, methods, and an object. It includes a 'Main' method that instantiates the class and calls both a public and a private method. The program prints messages to the console to illustrate the functionality of these methods.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

...................................................................................

...............................................................
Creating
1. class
2. methods
3. object
..................................................................
Calling Methods In the Main method
class Program
{
static void Main(string[] args)
{
Program p1 = new Program();
Console.WriteLine(" class program\n\n methods");
p1.myPublic();
p1.myPrivate();
Console.ReadKey();
}
public void myPublic()
{
Console.WriteLine("public method");
}
private void myPrivate()
{
Console.WriteLine("private method");
}

}
.............................................................................

You might also like