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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:19:59+00:00 2026-06-14T00:19:59+00:00

The following code does not compile in Visual Studio 2005: class OriginalClass { public:

  • 0

The following code does not compile in Visual Studio 2005:

class OriginalClass
{
public:
    class Delegate
    {
        virtual void original_func()=0;
    };
};

class BaseClass
    :public OriginalClass::Delegate //  Problem line 1
{
public:
    class Delegate
    {
        virtual void base_func(int x) = 0;
    };

    void original_func()override{}  //  Problem line 2
};

class DerivedClass : public BaseClass::Delegate
{
public:
    virtual void base_func(int x) override {};
};

int main ()
{
    DerivedClass derived_object;

    derived_object.base_func(10);
}

The build output is:

1>inherit\main.cpp(26) : error C3668: 'DerivedClass::base_func' : method with override specifier 'override' did not override any base class methods
1>inherit\main.cpp(32) : error C2259: 'DerivedClass' : cannot instantiate abstract class
1>        due to following members:
1>        'void OriginalClass::Delegate::original_func(void)' : is abstract
1>        inherit\main.cpp(7) : see declaration of 'OriginalClass::Delegate::original_func'

If I comment out the lines marked Problem line 1 and Problem line 2 it builds OK. So, the use of override is not a problem, nor is inheriting from the nested class. It seems to have difficulty in figuring out which Delegate class is the correct one to use.

This problem does not exist in VC2008.

Can anyone suggest a workaround for this? Besides the obvious: upgrade to a modern compiler!

Also, I would appreciate it if anyone can point to any documentation of the bug (if it is a bug).

Edit:
@Anonymous Coward suggested using typedefs, it will compile if the OriginalClass is changed to the following:

class OriginalClass
{
public:
    class Delegate_t
    {
        virtual void original_func()=0;
    };
    typedef Delegate_t Delegate;
};
  • 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-14T00:20:00+00:00Added an answer on June 14, 2026 at 12:20 am

    That seems to be a name resolution problem indeed. It compiles when using typedefs:

    class OriginalClass {
        // class Delegate { ... };
        typedef Delegate delegate_t;
    };
    
    class BaseClass : public OriginalClass::delegate_t {
        // class Delegate { ... };
        typedef Delegate delegate_t;
    };
    
    class DerivedClass : public BaseClass::delegate_t {
        // ...
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code does not compile in Visual Studio 2008. How do I get
The following piece of C# code does not compile: public class A { public
Why does the following code compile with the Dev-C++ compiler and not with Visual
The following code will not compile against the Async CTP in Visual Studio 2010:
The following code doesn't compile with gcc, but does with Visual Studio: template <typename
The following code does not compile, saying error C2248: 'A::getMe' : cannot access private
The following code does not compile: //int a = ... int? b = (int?)
The following code does not want to compile. See the included error message. Code:
The following code doesn't work (of course), because the marked line does not compile:
The following code compiles with G++ 4.6.1, but not with Visual Studio 2008 return

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.