How will you call non-abstract methods of an abstract class in derived class?

 Posted by rajarsn-7627 on 5/16/2012 | Category: C# Interview questions | Views: 2071 | Points: 40
Answer:

We can call the methods inside the constructor. For eg:


public class AbstractTest
{
public abstract class AbstractClass
{

public abstract void Method1();

public string GetFullname(string lastname, string firstname)
{
return firstname + lastname;
}
}

public class DerivedClass : AbstractClass
{


public override void Method1()
{
throw new NotImplementedException();
}

public DerivedClass()
{
string fullname = GetFullname("Vijay", "Chakraborty");
//Do further implementation

}

}


Source: In an interview | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Akiii on: 5/17/2012 | Points: 10
This is good....


Regards
Akiii

Login to post response

More Interview Questions by rajarsn-7627