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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:18:34+00:00 2026-06-14T19:18:34+00:00

Okay so basically I have the following problem: I’m trying to have an abstract

  • 0

Okay so basically I have the following problem: I’m trying to have an abstract class inherit another abstract class that has an abstract method, but I don’t want to implement the abstract method in either of them because a third class inherits from both of them:

public abstract class Command
{
      public abstract object execute();
}

public abstract class Binary : Command
{
     public abstract object execute(); //the issue is here
}

public class Multiply : Binary
{
     public override object execute()
     {
           //do stuff
     }
}

I’m trying to separate binary commands from unary commands but don’t want to/can’t implement the execute method in either. I thought about having Binary override the abstract method (since it has to), and then just throw a not implemented exception thing. If I make it override, then I must declare a body, but if I make it abstract, then I’m “hiding” the inherited method.

Any thoughts?

  • 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-14T19:18:35+00:00Added an answer on June 14, 2026 at 7:18 pm

    You don’t need to declare execute() in the Binary class since it’s already inherited from Command. Abstract methods don’t need to be implemented by other abstract classes – the requirement is passed on to the eventual concrete classes.

    public abstract class Command
    {
        public abstract object execute();
    }
    
    public abstract class Binary : Command
    {
        //the execute object is inherited from the command class.
    }
    
    public class Multiply : Binary
    {
        public override object execute()
        {
            //do stuff
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so i have done a tutorial that has me populating a TableViewController from
Okay, I have the following YAML file that was generated by using yaml_db for
Okay, I have a method that takes the variables: an image, int x, int
Okay so I have a driver class called MonthlyReport that reads in data from
Okay so i have a packed a proprietary binary format. That is basically a
Okay basically I have an MFC application with lots of dialogs that need to
Okay so basically, i have been trying this for and hour or 2 now.
Okay basically here's where I'm at. I have a list of PropertyDescriptor objects. These
Okay, basically, I have a large list of phone numbers in a text file
Okay guys, basically the problem I'm having is this. I've been assigned to write

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.