Differentiate between an abstract class and an interface?
Differentiate between an abstract class and an interface?
Hi, my self Ravi Vishwakarma. I have completed my studies at SPICBB Varanasi. now I completed MCA with 76% form Veer Bahadur Singh Purvanchal University Jaunpur.
SWE @ MindStick | Software Engineer | Web Developer | .Net Developer | Web Developer | Backend Engineer | .NET Core Developer
Ashutosh Kumar Verma
25-Aug-2021Difference between Abstract class and Interface
There are some basic difference between abstract class and Interface
Abstract class Interface
abstract class Animal { interface InterfaceClass {public abstract void Dog(); void Night(); // method without body
public void Cat() { }
Console.WriteLine('Cat cry like meuuuu'); class Inte :InterfaceClass{
} public void Night(){
} Console.WriteLine('everyday '); //override
class Flower : Animal { }
public override void Dog() { }
Console.WriteLine('Dog is bark'); class Interface {
} static void Main(String[] arg) { } Inte inte =new Inte();
class Abstract { inte.Night();
static void Main(string[] arg) { }
Flower rose = new Flower(); }
rose.Dog();
rose.Cat();
}
}
note- we can pass parameter in abstract method in Abstract class and Interface. In both abstract class and interface, methods are declare without his body. Its being terminate by semicolon (;).