By Team Escalera
on 31 Oct 2017 03:32 PM
  • learn C#
0 comments

Class Constructor Example C#

class Person
{
private int age;
private string name;
public Person(string pn)
{
name = pn;
}

public string printName()
{
return name;
}
}
static void Main(string[] args)
{
Person b= new Person(“Manish”);
Console.WriteLine(b.printName());
}

Output – Manish

Comments (0)

Leave A Comment