object of abstract class

Posted on 2011-10-24
Last Modified: 2012-05-12

Why object of abstract class can’t be instantiate?

Karan Gupta
Question by:KaranGupta
    LVL 15

    Accepted Solution

    this is how you do object oriented programming :)
    LVL 9

    Assisted Solution

    Use of abstract class

    Abstract class is specifically designed to be only derived.
    Abstract class has pure virtual functions/methods that must be overriden by the class inherits abstract class.
    Instantiating a class that has pure virtual functions is pointless.
    Abstract class enforces certain hierarchies for all the subclasses.
    LVL 17

    Assisted Solution

    According to OOPs, You can not instantiate an abstract class or an interface - you can instantiate one of their subclasses/implementers.

    interface I1
       void M();
    abstract class AB
       public abstract void M();

    public class subClass : AB, I1

    new subClass(); //OK

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now