Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

VS 2005 Relatime usage of abstract class and interfaces

priyajee

New member
Joined
Oct 19, 2007
Messages
144
Hi all,
I jus want to know the situations of using abstract class and interfaces in real time.

plz anyone reply me..:)

Thnks,
Priyajee
 

gep13

ASP.NET Moderator
Joined
Nov 16, 2004
Messages
21,966
Hey,

When you refer to "real time", are you actually meaning in real world example?

I use abstract classes for the Data Provider Model that I use. The Abstract Base classes define what methods need to be overridden by the actual Data Provider.

So, for instance, I have an Abstract Base Class called ArticlesProvider, which has methods such as GetArticles, UpdateArticle etc.

Then I have other classes, namely SqlArticleProvider, and MySqlArticleProvider which inherit from the Abstract Base Class, and implement those methods specifically for SQL Server and MySql Database.

Hope that helps!!

Gary
 

Prahlad

New member
Joined
Jan 4, 2020
Messages
55
Hey,

When you refer to "real time", are you actually meaning in real world example?

Interface is used when you want to define a contract and you don't know anything about implementation.

Abstract class is used when you know something and rely on others for what you don't know.

EX:-
we want to start a service like "makemytrip.com" or "paytm" where we are responsible for displaying the flights from various flight service company and place an order from customer.
Lets keep our service as simple as,
1.Displaying flights available from vendors like "airasia", "jetair" and "emirates".
2.Place and order for seat to respective vendor.

suppose I have to use few methods everytime like Flight,Flight_time etc i.e complasary to override those methods .so these all are abstract method and service,food that is not complasary that would be considered as non-abstract method.That time using abstract class is not required . because all flight depends on factors like time,service etc..That time interface are not used.
 
Top