Manish Pansiniya's Blog

.NET, C#, Javascript, ASP.NET and lots more…:)

Abstract Classes Vs. Interface – Why and When

leave a comment »

As you know the difference between abstract class and interface, sometimes I wonder what to use in project.

Abstract Classes is similar to interface but might be with implementation.

Interface is without implementation, just interface or virtual methods.

As per my understanding, it is can-do or is-do relationship. Like, from .NET framework, there are many interface like IComparer, ISortable etc. So, it is something like, classes derived from the interface CAN-DO these things.

But if the abstract class is CompareBase and if you are deriving classes from this class named TestCompare, then you can say that TestCompare IS DOing CompareBase.

Actually, you can find awkward but if you think over it, you can get this concept easily. Also, when you are deriving from multiple inheritance, you can say like, this class CAN DO this and CAN DO that etc.

Hope You Getting This 😀

Advertisements

Written by Manish

April 20, 2009 at 11:20 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: