Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7045349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:31:12+00:00 2026-05-28T02:31:12+00:00

I have a confusion in why we use abstract classes or interfaces to implement

  • 0

I have a confusion in why we use abstract classes or interfaces to implement or extend. interfaces doesn’t contain any code so does the abstract methods. then why we use them. why don’t we directly create methods and define them in our class rather we use interfaces or abstract classes. they don’t contain any sort of code, we need to define them after extending them in our class. why we don’t define these methods in our own class rather extend interfaces and then define them. I found such type of question asked several times in stackoverflow but couldn’t understand the answer. can anyone please explain it in some simple way

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:31:12+00:00Added an answer on May 28, 2026 at 2:31 am

    The power of abstraction and interfaces comes from the fact that you can separate responsibilities and write modular code: One part of your (or someone else’s) code may only care that you have an Animal and provide facilities to deal with Animals, without needing to know how they move or feed. A different part of your code may only care about defining lots of concrete animals, like Dogs, Birds, etc., with all the details of how they actually implement all their features.

    By making the concrete classes (Dog, Bird, …) extend a common, abstract interface (Animal), you can use a any now and future concrete class in a library written for the abstract interface — you don’t need to ask the library author to change the library to accommodate new Animals, and the library author doesn’t need to know how features are concretely implemented.

    For example, if you had two single algorithm, FeedBreakfast and FeedDinner, that would require a member function Animal::gobble(), then without inheritance you would need to implement each algorithm for each animal – i.e. you’d end up with M * N amount of code! By using a common, abstract interface you reduce this to M + N — M algorithms and N concrete classes, and neither side needs to know of the other — they just both need to know the interface.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have confusion about GridView in ASP.NET. How does the GridView exactly work? I
I use syntax like name varchar(20) NOT NULL in mysql..i have a big confusion
Possible Duplicates: Abstract classes vs Interfaces Abstract class and Interface class? Hi All, I
I have a little confusion with the following things: Null DBNull.Value When I use
I have confusion on following c code #define MACRO (xx) \ foo(xx) ... #ifdef
I have some confusion about how to use AtlasLabel. It seems Label consume a
I Have some confusion while using Convert.Int32() and int32.Parse(). When we use Convert.Int32() or
I have some confusion regarding When should we use disributed architecture. I know concept
I have the following classes: public abstract class BaseClass { private readonly double cachedValue;
I have some confusion about when to use the self keyword during ivars assignment,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.