You are on page 1of 2

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace practice
{

class student
{
public int stdid;

public student()
{
stdid = 100;
}
}

public class exam


{
public static string stdName;

public exam()
{
student student = new student();
student.stdid = 100;
Console.WriteLine(student.stdid);

salaan();

var num = number();


Console.WriteLine($"This number is {num}");

var sum = add(2, 5);


Console.WriteLine($"The Sum of the numbers are {sum}");
}

// non-return type method


public void salaan()
{
Console.WriteLine("Welcome");
}

// return type method


public int number()
{

return 200;
}

//Parameterized Method
public int add(int a , int b)
{
return a + b;
}

//properties
public int age { get; set; }

//advanced
public string user;
public string userType
{
get { return user; }
set { user = value; }
}

internal class Program


{
static void Main(string[] args)
{
/* student student = new student();
student.stdid = 100;
Console.WriteLine(student.stdid); */

exam ex = new exam();

ex.age = 22;
Console.WriteLine(ex.age);

ex.userType = "Admin";
Console.WriteLine(ex.userType);

exam.stdName = "Ahmed";
Console.WriteLine($"This student is: {exam.stdName}");

}
}
}

You might also like