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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:05:08+00:00 2026-06-13T14:05:08+00:00

I have a hierarchy: class ICommand { public: virtual void start() = 0; };

  • 0

I have a hierarchy:

class ICommand
{
    public:
        virtual void start() = 0;
};

class IExtendedCommand : public ICommand
{
    public:
        virtual void doSomethingElse() = 0;
};

class ConcreteCommand : public ICommand
{
    public:
        virtual void start() {};
}    
class ExtendedConcreteCommand : public ConcreteCommand, public IExtendedCommand
{
    public:
        virtual void doSomethingElse() {};
}

ICommand and IExtendedCommand objects are being created by factory.

For some reason when compiler says that all of ICommand’s methods are pure within ExtendedConcreteCommand…

Any ideas why and how to solve this?

PS: Yes I’m porting my Android app to C++/Qt (which I haven’t used for 3 years).
Anyway I’d like to hear how you would cope with this.

EDIT:

What I’m porting is a remote control application for MPC and VLC.
The idea is to create commands that can be sent to the player through a factory.
Factory returns a pointer to an object that implements ICommand. So by switching factory implementations different commands can be created. ICommand declares all the main methods and signals. IExtendedCommand adds some generic info across players. So what I’d like to do is instantiate IExtendedCommand through a factory, set some properties and then launch it with start() method. Also I’d like to reuse ConcreteCommand’s functionality. That leads to the issue I described.

  • 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-13T14:05:09+00:00Added an answer on June 13, 2026 at 2:05 pm

    You don’t have a diamond. You have this:

       +----------------------------------- missing start() !
       V
    pv start()     pv doSomethingElse()     concrete doSomethingElse()
    
    ICommand  ---> IExtendedCommand   ---\
                                          > ExtendedConcreteCommand
    ICommand  ---> ConcreteCommand    ---/
    
    pv start()     concrete start()
    

    That means that you have two base classes of type ICommand, and you need to override both their pure methods. But only ConcreteCommand overrides the “bottom” version of start, and the other one remains unoverridden.

    If you want an actual diamond, you need to make the ICommand base class virtual by using virtual inheritance: class IExtendedCommand : virtual public ICommand, and likewise for ConcreteCommand. Alternatively, you can provide another overrider for start in ExtendedConcreteCommand.

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

Sidebar

Related Questions

Say I have the following hierarchy: public class MyClass { protected virtual void Method()
Suppose I have this class hierarchy: class A { public: virtual void foo(Base *b)
Let's say I have the following class hierarchy: class Base { protected: virtual void
I have the following class hierarchy [BsonKnownTypes(typeof(MoveCommand))] public abstract class Command : ICommand {
Suppose you have the following object hierarchy: class Vehicle { public: virtual ~Vehicle() {}
Let's say I have these class hierarchy : public abstract class Parent { }
I have a hierarchy of objects define as follows: class Request { RequestType type
I have hierarchy: public class Parameter { public string Name { get; set; }
I have this class hierarchy: public interface ISR { } public interface ICU {
I have a class hierarchy and i am writing a virtual function in it.

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.