<?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>Wizcodersolution.com</title>
	<atom:link href="http://wizcodersolution.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wizcodersolution.com</link>
	<description>Coding in the Age of Web 2.0</description>
	<lastBuildDate>Sat, 22 Oct 2011 14:54:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Abstract Class Implementing Interface</title>
		<link>http://wizcodersolution.com/2011/10/22/abstract-class-implementing-interface/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=abstract-class-implementing-interface</link>
		<comments>http://wizcodersolution.com/2011/10/22/abstract-class-implementing-interface/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 14:54:55 +0000</pubDate>
		<dc:creator>WizCoder</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://wizcodersolution.com/?p=607</guid>
		<description><![CDATA[Abstract Class Implementing Interface. Recenlty I took a technically test and I have write an employee class for an aspx page that will use an abstract class that implements an Interface. What is abstract class ? Abstract class is a &#8230; <a href="http://wizcodersolution.com/2011/10/22/abstract-class-implementing-interface/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Abstract Class Implementing Interface.</p>
<p>Recenlty I took a technically test and I have write an employee class for an aspx page that will<br />
use an abstract class that implements an Interface. </p>
<p>What is abstract class ?<br />
Abstract class is a base class or a parent class. Abstract classes can have empty abstract methods<br />
or it can have implemented methods which can be overridden by child classes. </p>
<p>What are interfaces?<br />
Interface is a contract class with empty methods, properties and functions.<br />
Any class which implements the interface has to compulsory implement all the<br />
empty methods, functions and properties of the interface.</p>
<p>Interface<br />
<code><br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;</p>
<p>namespace Employee.Interface<br />
{<br />
    public interface IEmployee<br />
    {<br />
		String Name<br />
		{<br />
			get;<br />
			set;<br />
		}</p>
<p>		String DateJoin<br />
		{<br />
			get;<br />
			set;<br />
		}</p>
<p>        String Department<br />
        {<br />
            get;<br />
            set;<br />
        }</p>
<p>        bool Save(String mName, String mDate, String mDepartment);<br />
    }<br />
}<br />
</code></p>
<p>Abstract Class</p>
<p><code><br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using Employee.Interface;</p>
<p>namespace Employee.Abstract<br />
{<br />
    public abstract class AEmployee:IEmployee<br />
    {<br />
        public abstract String Name<br />
		{<br />
			get;<br />
			set;<br />
		}</p>
<p>        public abstract String DateJoin<br />
		{<br />
			get;<br />
			set;<br />
		}</p>
<p>        public abstract String Department<br />
		{<br />
			get;<br />
			set;<br />
		}</p>
<p>        public abstract bool Save(String mName, String mDate, String mDepartment);</p>
<p>    }<br />
}<br />
</code></p>
<p>Employee Class<br />
<code><br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using Employee.Abstract;</p>
<p>namespace Employee<br />
{<br />
    public class Employee : AEmployee<br />
    {<br />
        private String _Name = String.Empty;<br />
        private String _DateJoin = String.Empty;<br />
        private String _Department = String.Empty;</p>
<p>        public override String Name<br />
        {<br />
            get<br />
            {</p>
<p>                return _Name;<br />
            }<br />
            set<br />
            {<br />
                _Name = value;<br />
            }<br />
        }</p>
<p>        public override String DateJoin<br />
        {<br />
            get<br />
            {<br />
                return _DateJoin;<br />
            }<br />
            set<br />
            {<br />
                _DateJoin = value;<br />
            }<br />
        }</p>
<p>        public override String Department<br />
        {<br />
            get<br />
            {<br />
                return _Department;<br />
            }<br />
            set<br />
            {<br />
                _Department = value;<br />
            }<br />
        }</p>
<p>        public override bool Save(String mName, String mDate, String mDepartment)<br />
        {<br />
            bool success = false;<br />
            try<br />
            {<br />
                _Name = mName;<br />
                _DateJoin = mDate;<br />
                _Department = mDepartment;</p>
<p>                //Code to save<br />
                //<br />
                success = true;<br />
            }<br />
            catch (Exception)<br />
            {<br />
                throw;<br />
            }<br />
            return success;<br />
        }<br />
    }<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://wizcodersolution.com/2011/10/22/abstract-class-implementing-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

