Construction of the base class constructor class assignment

Viewed 135
public class Test1
{
    public int Q1 { get; set; }
    public string Q2 { get; set; }

}

public class Test2 : Test1
{
    public Test2(Test1 Value)
    {
        Q1 = Value.Q1;
        Q2 = Value.Q2;
        //Does this way of writing is getting very long and difficult

    }
}

public class Test2 : Test1
{
    public Test2(Test1 Value)
    {
        base = Value;
        //In this way a short and easy ways
    }
}



   public Test1 ExampleTest()
    {
        return new Test1();
    }

    public void Example()
    {
        Test2 t = new Test2();

        t = ExampleTest();
    }

I direct assignment to the class inheritance How do I get?

1 Answers
Related