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 8527731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:38:19+00:00 2026-06-11T08:38:19+00:00

I am using a class say baseClass , from which I derive another class

  • 0

I am using a class say baseClass, from which I derive another class derivedClass. I have a problem definition that says, apart from others:

i) A member – object initialiser should be used to initialise a data member, say var1, that is declared in the base class.

ii) i) is done inside a base class constructor. It says, this has to be invoked only via a derived class constructor.

iii) The base class is an abstract class, whose objects cannot be created. But, I have a third class, inside which, I use:

baseClass *baseObjects[5];

The compiler does not report an error.

I do not understand, what i) and ii) really mean. An explanation in simple words would be fine. Also, any assistance on iii) is welcome.

  • 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-11T08:38:20+00:00Added an answer on June 11, 2026 at 8:38 am

    I think an illustration will be best.

    i)

    class A
    {
      int i;
     public:
      A(int ii) : i(ii) {}
    }
    

    The part i(ii) is an example of a member – object initialiser. Since C++ guarantees all constructors of members will be called before the constructor body is entered, this is your only way of specifying which constructor to call for each member.

    ii) In C++ there is no super keyword. You must specify the base class as such:

     class B : public A
     {
     public:
       B(int i) : A(i) {}
     }
    

    That’s partially due to the fact C++ allows multiple inheritence.

    iii) Note that you haven’t created any objects, only pointers to objects. And it’s by this method polymorphism via inheritence is acheived in C++.

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

Sidebar

Related Questions

I have a class A that implements IEquatable<>, using its fields (say, A.b and
Let's say I have a base class Animal from which a class Cow inherits,
Say I have a template class that takes msgs from source, does something smart
I have a conceptual Python design dilemma. Say I have a City class, which
Let's say I have a base class named Entity . In that class, I
I have a virtual class that has been derived from a non virtual class.
Here's the situation. I have a base class which implements a method that accepts
I have a class, lets call it A, and within that class definition I
Let's say that I have a class/table called Images that, as it stands right
I'm having a problem using inheritance and the STL list library... Say, I have

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.