What is class in C#

Class is a template, declaration or blueprint that is used for clarify object. It summarize variable members, functions, structure, properties and many more part. It is the basic building block of object oriented programming. In order to create class, the class keyword is used.

Syntex

class Print
  {
  }
After creating class, you can use it by creating its object. An object is created using new keyword. Suppose you created a class print that contain following method.
class Print
  {
    public void printname()
     {
       Console.WriteLine("Hello Pawan");
     }
  }
Print pr = new Print();
pr.PrintHello();

Leave a Reply

Your email address will not be published. Required fields are marked *