Hi all i have some doubts about abstract class and interface
Am not asking about difference between interface and abstract class . Am just asking about different between abstract method and interface method
Abstract methods are same as interface methods . I know if we inherit the interface and abstract class in child class ,then we must implement the those side methods .But we can't implement the non abstract methods. So
- my question is what is the different between abstract method and interface ?
and
2". another question is we can partially implement the Non-abstract methods in abstract class , Is it possible to partially implement the abstract method in abstract class ?
I also referred many sites , but does not one give the solution for second question
Question with code
Here is my abstract class and have one abstract method(xxx) and another one non abstract moethod(yyy) and interface method (xxx)
public abstract class AbstractRam
{
public abstract int xxx();// What is the difference in interface method ?
public int yyy()
{
return 2;
}
}
public interface InterfaceRam
{
int xxx();// What is the difference in abstract method ?
}
and i inherited the both in another class
public class OrdinaryClass : AbstractRam
{
public OrdinaryClass()
{
//
// TODO: Add constructor logic here
//
}
public override int xxx()
{
return 1;
}
}
public class OrdinaryClass2 : InterfaceRam
{
public OrdinaryClass2()
{
//
// TODO: Add constructor logic here
//
}
public int xxx()
{
return 1;
}
}
Let see my xxx method , Both methodes are working same , Not a big difference
question : Is it have any difference ? if is it same , then which one is the best way ?