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

C# Person Class Example Code

Uploaded by

yasir lashari
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)
7 views1 page

C# Person Class Example Code

Uploaded by

yasir lashari
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

using System;

public class Person //Person is class


{
//properties or Attributes
public string Name;
public int Age;
public double Height;
public double Width;

//Method (Behaviour)
public void Walk()
{
[Link](Name + "is walking");
}
public void Talk()
{
[Link](Name + "is Talking");
}
public void Eat()
{
[Link](Name + "is Eating");
}
public void Sleep()
{
[Link](Name + "Is Sleeping");
}

class Program
{
static void Main(string[] args)
{
//Creating object 1 - yasir
Person obj = new Person();
[Link] = "Yasir";
[Link] = 5;
[Link] = 50;
[Link] = 50;
[Link]();
//Creating object 2 - Ali
Person obje = new Person();
[Link] = "Ali";
[Link] = 53;
[Link] = 57;
[Link] = 52;
[Link]();
//Creating object 3 - Muhammad
Person objec = new Person();
[Link] = "Muhammad";
[Link] = 3;
[Link] = 27;
[Link] = 32;
[Link]();
}
}

You might also like