Pages

Monday, May 13, 2013

How can set the value in ur program?

public partial class How_can_set_the_value_in_ur_program : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        A a=new A();
        Doctor d1=a.m();
        d1.setAge(38);
        int age=d1.Ge

    }
}
public class Doctor
{
    private int age;
    private string name;
    public Doctor(int age,string name)
    {
        this.age=age;
        this.name=name;
    }
    public void setAge(int newage)
   {
    if(newage>=26 && age<<=58)
    {
        age=newage;
    }
    }
    public int Getmethod
    {
       return age;
    }
}
public class A
{
    public Doctor m()
    {
        Doctor d=new Doctor(34,"ramesh");
        return d;
    }
}

No comments:

Post a Comment