<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>abstract class &#8211; SAP EWM Help</title>
	<atom:link href="https://www.sapewmhelp.com/question-tag/abstract-class/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sapewmhelp.com</link>
	<description>SAP EWM questions answered by experts — ABAP, S/4HANA, warehouse management</description>
	<lastBuildDate>Wed, 27 Aug 2025 07:56:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>
	<item>
		<title>What is the difference between abstract class and an interface ?</title>
		<link>https://www.sapewmhelp.com/question/what-is-the-difference-between-abstract-class-and-an-interface/</link>
					<comments>https://www.sapewmhelp.com/question/what-is-the-difference-between-abstract-class-and-an-interface/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Wed, 27 Aug 2025 07:56:34 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=what-is-the-difference-between-abstract-class-and-an-interface</guid>

					<description><![CDATA[Abstract Class Defined with CLASS ... DEFINITION ABSTRACT. Can have: Attributes (data) Concrete methods (implemented) Abstract methods (declared but not implemented — must be redefined in subclass) Cannot be instantiated directly — only subclasses can be created. Supports inheritance (a subclass inherits implementation + attributes). Can implement interfaces too. Think of an abstract class as [&#8230;]]]></description>
										<content:encoded><![CDATA[<h5><strong>Abstract Class</strong></h5>
<ul>
<li>Defined with <code>CLASS ... DEFINITION ABSTRACT</code>.</li>
<li>Can have:
<ul>
<li><strong>Attributes (data)</strong></li>
<li><strong>Concrete methods</strong> (implemented)</li>
<li><strong>Abstract methods</strong> (declared but not implemented — must be redefined in subclass)</li>
</ul>
</li>
<li>Cannot be instantiated directly — only subclasses can be created.</li>
<li>Supports <strong>inheritance</strong> (a subclass inherits implementation + attributes).</li>
<li>Can implement <strong>interfaces</strong> too.</li>
</ul>
<p>Think of an abstract class as a <strong>partially implemented blueprint</strong>.</p>
</p>
<p><strong>Example :</strong></p>
<p>CLASS cl_vehicle DEFINITION ABSTRACT.<br />
PUBLIC SECTION.<br />
METHODS: start ABSTRACT, &#8221; must be implemented in subclass<br />
stop. &#8221; already implemented<br />
ENDCLASS.</p>
<p>CLASS cl_vehicle IMPLEMENTATION.<br />
METHOD stop.<br />
WRITE: / &#8216;Vehicle stopped.&#8217;.<br />
ENDMETHOD.<br />
ENDCLASS.</p>
<p>&nbsp;</p>
<h5><strong>Interface</strong></h5>
<ul>
<li>Defined with <code>INTERFACE ...</code>.</li>
<li>Can contain:</li>
<li>Method declarations only (no implementation).</li>
<li>Constants, types, attributes (but no data storage).</li>
<li>No concrete code inside (implementation happens in the class that implements it).</li>
<li>A class can implement multiple interfaces (like multiple inheritance).</li>
<li>Cannot be instantiated or inherited — only implemented.</li>
</ul>
<p>Think of an interface as a <strong>contract</strong>: <em>“any class implementing me must provide these methods.”</em></p>
</p>
<p><strong>Example:</strong></p>
<p>INTERFACE if_flyable.<br />
METHODS fly.<br />
ENDINTERFACE.</p>
<p>INTERFACE if_swimmable.<br />
METHODS swim.<br />
ENDINTERFACE.</p>
<p><strong>Key Differences:</strong></p>
<table>
<thead>
<tr>
<th>Feature</th>
<th><strong>Abstract Class</strong></th>
<th><strong>Interface</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Instantiation</strong></td>
<td>Cannot be instantiated</td>
<td>Cannot be instantiated</td>
</tr>
<tr>
<td><strong>Inheritance</strong></td>
<td>Single inheritance only</td>
<td>Multiple interfaces can be implemented</td>
</tr>
<tr>
<td><strong>Implementation</strong></td>
<td>Can have <strong>abstract + concrete methods</strong></td>
<td>Only method <strong>signatures</strong>, no code</td>
</tr>
<tr>
<td><strong>Attributes</strong></td>
<td>Yes (instance &amp; static data possible)</td>
<td>Only <strong>constants/types</strong>, no data</td>
</tr>
<tr>
<td><strong>Purpose</strong></td>
<td>Provide a <strong>base class with shared logic</strong></td>
<td>Define a <strong>contract for behavior</strong></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h5>When to Use</h5>
<ul>
<li>
<p>Use an <strong>abstract class</strong> when:</p>
<ul>
<li>
<p>You want to share <strong>implementation</strong> across subclasses.</p>
</li>
<li>
<p>You want to define <strong>default behavior</strong> that can be reused.</p>
</li>
<li>
<p>Example: <code>CL_VEHICLE</code> (base) → <code>CL_CAR</code>, <code>CL_TRUCK</code>.</p>
</li>
</ul>
</li>
<li>
<p>Use an <strong>interface</strong> when:</p>
<ul>
<li>
<p>You just need a <strong>common contract</strong> across unrelated classes.</p>
</li>
<li>
<p>You want to achieve <strong>multiple inheritance</strong> of behavior.</p>
</li>
<li>
<p>Example: <code>IF_FLYABLE</code>, <code>IF_SWIMMABLE</code>, <code>IF_SERIALIZABLE</code>.</p>
</li>
</ul>
</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/what-is-the-difference-between-abstract-class-and-an-interface/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
