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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:44:45+00:00 2026-06-01T17:44:45+00:00

let us suppose some (legacy) code, which cannot be touched, declare struct B{ public:

  • 0

let us suppose some (legacy) code, which cannot be touched, declare

struct B{
 public:
  void f(){}
};

and let us suppose to have

struct A{
 public:
  virtual void f()=0;
};

is it possible to make an A subclass call B::f without explicitly calling f(), i.e. instead of

  struct C: public A, public B{
   void f(){
   B::f();
  }
 };

having something like

 struct C:virtual public A,virtual public B{

 };

(note that this last class is abstract, for the compiler A::f is not defined)

  • 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-01T17:44:47+00:00Added an answer on June 1, 2026 at 5:44 pm

    Directly in C++, it is impossible to dispatch polymorphically based on some implicit matching of B’s functions to A’s. You could resort to some kind of code generation using gccxml or other similar products, but if there’s only a hundred functions a macro can reduce the forwarding to a one-liner anyway – not worth introducing extra tools unless you’ve got thousands and thousands of these to do.

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

Sidebar

Related Questions

Suppose I have some code: let listB = [ 1; 2; 3 ] Using
Let's suppose I have n arrays, where n is a variable (some number greater
Let's suppose I have xml like this one: <Server Active=No> <Url>http://some.url</Url> </Server> C# class
Let's suppose I have a function: int f1(int x){ // some more or less
Let's suppose I have a valid Ant build script which packs up and prepares
Let's suppose I have some method that returns a IEnumerable<int> object. This methods make
Let's suppose I have created a view that shows some kind of stories. But
Let's suppose I have this piece of code. foreach(string value in myList) { string
Let's suppose I have some div with picture. Above this div there is another
Let's suppose I have some element and also have some picture in folder. So

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.