<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://jholjhapata.com/index.php?action=history&amp;feed=atom&amp;title=Difference_Between_Interface_vs_Abstract_Class</id>
	<title>Difference Between Interface vs Abstract Class - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://jholjhapata.com/index.php?action=history&amp;feed=atom&amp;title=Difference_Between_Interface_vs_Abstract_Class"/>
	<link rel="alternate" type="text/html" href="https://jholjhapata.com/index.php?title=Difference_Between_Interface_vs_Abstract_Class&amp;action=history"/>
	<updated>2026-06-28T21:13:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://jholjhapata.com/index.php?title=Difference_Between_Interface_vs_Abstract_Class&amp;diff=100&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;Interface and Abstract Class, both are the ways to achieve the abstraction in C#. == Abstract Class == An '''Abstract class''' is never intended to be instantiated directly. T...&quot;</title>
		<link rel="alternate" type="text/html" href="https://jholjhapata.com/index.php?title=Difference_Between_Interface_vs_Abstract_Class&amp;diff=100&amp;oldid=prev"/>
		<updated>2020-01-05T06:58:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Interface and Abstract Class, both are the ways to achieve the abstraction in C#. == Abstract Class == An &amp;#039;&amp;#039;&amp;#039;Abstract class&amp;#039;&amp;#039;&amp;#039; is never intended to be instantiated directly. T...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Interface and Abstract Class, both are the ways to achieve the abstraction in C#.&lt;br /&gt;
== Abstract Class ==&lt;br /&gt;
An '''Abstract class''' is never intended to be instantiated directly. This class must contain at least one abstract method, which is marked by the keyword '''abstract''' in the class definition. The Abstract classes are typically used to define a base class in the class hierarchy.&lt;br /&gt;
   abstract class Software&lt;br /&gt;
   {&lt;br /&gt;
       // Abstract method (does not have a body)&lt;br /&gt;
       public abstract void addIcon();&lt;br /&gt;
       // Regular method&lt;br /&gt;
       public void defaltPath()&lt;br /&gt;
       {&lt;br /&gt;
           Console.WriteLine(&amp;quot;c:&amp;quot;);&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
   // Derived class (inherit from Software)&lt;br /&gt;
   class WinZip : Software&lt;br /&gt;
   {&lt;br /&gt;
       public override void addIcon()&lt;br /&gt;
       {&lt;br /&gt;
           // The body of addIcon() is provided here&lt;br /&gt;
           Console.WriteLine(&amp;quot;Desktop&amp;quot;);&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
   class Program&lt;br /&gt;
   {&lt;br /&gt;
       static void Main(string[] args)&lt;br /&gt;
       {&lt;br /&gt;
           WinZip myWinZip = new WinZip(); // Create a WinZip object&lt;br /&gt;
           myWinZip.defaltPath();  // Call the abstract method&lt;br /&gt;
           myWinZip.addIcon();  // Call the regular method&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
== Interface ==&lt;br /&gt;
'''Interface''' can have methods, properties, events, and indexers as its members. But interfaces will contain only the declaration of the members. The implementation of interface’s members will be given by the class who implements the interface implicitly or explicitly.&lt;br /&gt;
   interface Software&lt;br /&gt;
   {&lt;br /&gt;
       // Abstract method (does not have a body)&lt;br /&gt;
       void addIcon();&lt;br /&gt;
       // Regular method&lt;br /&gt;
       void defaltPath();&lt;br /&gt;
   }&lt;br /&gt;
   // Derived class (inherit from Software)&lt;br /&gt;
   class WinZip : Software&lt;br /&gt;
   {&lt;br /&gt;
       public void addIcon()&lt;br /&gt;
       {&lt;br /&gt;
           // The body of addIcon() is provided here&lt;br /&gt;
           Console.WriteLine(&amp;quot;Desktop&amp;quot;);&lt;br /&gt;
       }&lt;br /&gt;
       public void defaltPath()&lt;br /&gt;
       {&lt;br /&gt;
           Console.WriteLine(&amp;quot;c:&amp;quot;);&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
   class Program&lt;br /&gt;
   {&lt;br /&gt;
       static void Main(string[] args)&lt;br /&gt;
       {&lt;br /&gt;
           WinZip myWinZip = new WinZip(); // Create a WinZip object&lt;br /&gt;
           myWinZip.defaltPath();  // Call the abstract method&lt;br /&gt;
           myWinZip.addIcon();  // Call the regular method&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
== Difference between Abstract Class and Interface ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! ABSTRACT CLASS !! INTERFACE&lt;br /&gt;
|-&lt;br /&gt;
| It contains both declaration and definition part. || It contains only a declaration part.&lt;br /&gt;
|-&lt;br /&gt;
| Multiple inheritance is not achieved by abstract class. || Multiple inheritance is achieved by interface.&lt;br /&gt;
|-&lt;br /&gt;
| It contain [[constructor]]. || It does not contain [[constructor]].&lt;br /&gt;
|-&lt;br /&gt;
| It can contain static members. || It does not contain static members.&lt;br /&gt;
|-&lt;br /&gt;
| It can contain different types of access modifiers like public, private, protected etc. || It only contains public access modifier because everything in the interface is public.&lt;br /&gt;
|-&lt;br /&gt;
| The performance of an abstract class is fast. || The performance of interface is slow because it requires time to search actual method in the corresponding class.&lt;br /&gt;
|-&lt;br /&gt;
| It is used to implement the core identity of class. || It is used to implement peripheral abilities of class.&lt;br /&gt;
|-&lt;br /&gt;
| A class can only use one abstract class. || A class can use multiple interface.&lt;br /&gt;
|-&lt;br /&gt;
| If many implementations are of the same kind and use common behavior, then it is superior to use abstract class. || If many implementations only share methods, then it is superior to use Interface.&lt;br /&gt;
|-&lt;br /&gt;
| Abstract class can contain methods, fields, constants, etc. || Interface can only contain methods.&lt;br /&gt;
|-&lt;br /&gt;
| It can be fully, partially or not implemented. || It should be fully implemented.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>