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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:17:02+00:00 2026-05-17T16:17:02+00:00

I have an issue where I have an interface that has parts that make

  • 0

I have an issue where I have an interface that has parts that make sense as templated, and parts that make sense as not-templated. I’m in the middle of a refactor where I’m splitting that out into two different interfaces where the more specific (the templated one) inherits from the other one. E.g., say I have an interface IArray, this would contain functions like Size() since it doesn’t care about the data type. But I’d have another interface ITArray<DataType> that would have something like DataType GetElement(...). (This is just for illustration, don’t yell at me to use std::vector). The reason I’m doing this refactor is that there are a lot of consumers of the non-templated interface and they’d like to not have to write templated functions that accept a templated interface if they don’t need the templated type (generally extern "C" stuff)

The problem is that I have overloaded functions that appear in both interfaces, but for some reason I can’t resolve the base class functions. Here’s a simple example that I put together that’s not compiling in MSVC:

#include <iostream>

class IA
{
public:
        virtual void X()=0;
};

template <class DataType>
class ITA : public IA
{
public:
        //If I uncomment this line, it all works!
        //virtual void X()=0;
        virtual void X(DataType d)=0;
};

template <class DataType>
class A : public ITA<DataType>
{
public:
    void X()
    {
        std::cout << "In X" << std::endl;
    }

    void X(DataType d)
    {
        std::cout << "In X, d=" << d << std::endl;
    }
};

template <class DataType>
void DoSomething(ITA<DataType>& I, DataType d)
{
    I.X(); //MSVC can't resolve this since it's in IA, not ITA
    I.X(d);
}

int main(int argc, char* argv[])
{
    A<int> I;
    DoSomething(I,10);
}

Is there some way that I can make IA’s functions appear in ITA<> without manually putting them there? I see a maintenance nightmare ahead of me.

  • 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-05-17T16:17:02+00:00Added an answer on May 17, 2026 at 4:17 pm

    Have you tried adding a using directive? IA::X is a hidden by A::X.

    class A : ...
    {
    public:
        using IA::X;
        virtual void X(DataType d) = 0; 
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java class that I'm debating what I should make it into
I've got an interface inheritance issue that has been vexing me for some time.
can anyone help, i have a small issue, i have an interface and also
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have somewhat of a problem. We have a centralized interface engine that will
In my program I have something close to 50 events that are thrown out.
I am working on a project that uses a touch-screen interface. I have a
I have an MVC 3 web app that has an Action which I need
I have an XCode project I am working on that has multiple views controlled
I have a Project entity that has a set of Word entities within. My

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.