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

  • Home
  • SEARCH
  • 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 7913057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:45:17+00:00 2026-06-03T13:45:17+00:00

I am learning Object Oriented Programming, but I am confused about abstract class and

  • 0

I am learning Object Oriented Programming, but I am confused about abstract class and concrete class. Some real world examples would be appreciated. And what are benefits of using one over another? When would one prefer abstract class and concrete class?

If answer is particular to any language than I am asking in context of Ruby

  • 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-06-03T13:45:18+00:00Added an answer on June 3, 2026 at 1:45 pm

    If you have an object which mustn’t get instantiated you should use an abstract class. A concrete class, though, should be used if you want to instantiate this class.

    Imagine you want several animal classes. But the rule is just to instantiate specific animals like a dog, cat or a mouse. But now all of those animals share some properties and methods – like a name. So you put them in a base class Animal to avoid code duplication. You can’t create an instance of Animal though:

    public abstract class Animal
    {
        public string Name { get; set; }
        public void Sleep()
        {
            // sleep
        }
    }
    
    public class Cat : Animal
    {
        public void Meow()
        {
            // meooooow
        }
    }
    
    public void DoSomething()
    {
        var animal = new Animal(); // illegal operation
        var cat    = new Cat();    // works fine
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently learning Object oriented Javascript but it seems that the alert is
I am designing an object-oriented programming language for the purpose of learning. The language
I have just started learning the concept of Object oriented programming and have put
I've recently been learning about functional programming (specifically Haskell, but I've gone through tutorials
I am a freshman in C++, especially about object-oriented programming. And now I have
So, I've taken a handful of programming courses(object-oriented, web) but never had hands-on projects
I'm new to object oriented programming and am slowly learning how to apply it
I'm fairly new to object-oriented programming, and I'm really interested in learning it correctly.
I'm learning Objective-C, and have a C/C++ background. In object-oriented C++, you always need
This is a question about using an object-oriented language. I've been using C++ to

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.