Results 1 to 3 of 3

Thread: Relatime usage of abstract class and interfaces

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2007
    Posts
    144

    Question Relatime usage of abstract class and interfaces

    Hi all,
    I jus want to know the situations of using abstract class and interfaces in real time.

    plz anyone reply me..

    Thnks,
    Priyajee

  2. #2
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,966

    Re: Relatime usage of abstract class and interfaces

    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

  3. #3
    Lively Member
    Join Date
    Jan 2020
    Posts
    80

    Re: Relatime usage of abstract class and interfaces

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width