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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:20:19+00:00 2026-06-01T14:20:19+00:00

I have 5 files: ExecutionStrategyInterface.h ExecutorInterface.h TaskCollectionInterface.h TaskExecutor.h TaskExecutor.cpp . TaskExecutor implements the following

  • 0

I have 5 files:

  • ExecutionStrategyInterface.h
  • ExecutorInterface.h
  • TaskCollectionInterface.h
  • TaskExecutor.h
  • TaskExecutor.cpp.

TaskExecutor implements the following member method:

void TaskExecutor::execute(TaskCollectionInterface* tci, const ExecutionStrategyInterface& es) {
    es.execute(tci);
}

At compile time, the compiler calls a member method with a parameter of type pointer to a reference
(i.e: mylib::core::TaskCollectionInterface*&).

TaskExecutor.cpp: In member function ‘virtual void mylib::core::TaskExecutor::execute(mylib::core::TaskCollectionInterface*, const mylib::core::ExecutionStrategyInterface&)’:
TaskExecutor.cpp:16: error: no matching function for call to ‘mylib::core::ExecutionStrategyInterface::execute(mylib::core::TaskCollectionInterface*&) const’
./././ExecutionStrategyInterface.h:24: note: candidates are: virtual void mylib::core::ExecutionStrategyInterface::execute(TaskCollectionInterface*) const
make: *** [TaskExecutor.o] Error 1

Can anyone explain me what is happening here please ?


Classes:

ExecutionStrategyInterface.h

#ifndef _EXECUTIONSTRATEGYINTERFACE_H_
#define _EXECUTIONSTRATEGYINTERFACE_H_

class TaskCollectionInterface;

namespace mylib { namespace core {

/**
 *  Interface for executing a strategy.
 */
class ExecutionStrategyInterface {
 public:
    /**
     * Executes a strategy
     */
    virtual void execute(TaskCollectionInterface* tci) const = 0;
};

}} // namespaces

#endif // _EXECUTIONSTRATEGYINTERFACE_H_

TaskCollectionInterface.h

#ifndef _TASKCOLLECTIONINTERFACE_H_
#define _TASKCOLLECTIONINTERFACE_H_

#include "./ExecutionStrategyInterface.h"

namespace mylib { namespace core {

/**
 *  Interface for a collection of tasks.
 */
class TaskCollectionInterface {
 public:
    ~TaskCollectionInterface();
};

}} // namespaces

#endif // _TASKCOLLECTIONINTERFACE_H_

ExecutorInterface.h

#ifndef _EXECUTORINTERFACE_H_
#define _EXECUTORINTERFACE_H_

class ExecutionStrategyInterface;
class TaskCollectionInterface;

#include "./ExecutionStrategyInterface.h"
#include "./TaskCollectionInterface.h"

namespace mylib { namespace core {

/**
 *  Interface for an executor.
 */
class ExecutorInterface {
 public:
    virtual void execute(TaskCollectionInterface* tci, const ExecutionStrategyInterface& es) = 0;
    ~ExecutorInterface();
};

}} // namespaces

#endif // _EXECUTORINTERFACE_H_

TaskExecutor.h

#ifndef _TASKEXECUTOR_H_
#define _TASKEXECUTOR_H_

#include "./ExecutorInterface.h"

class TaskCollectionInterface;
class ExecutionStrategyInterface;

namespace mylib { namespace core {

/**
 *  Task Runner.
 */
class TaskExecutor: public ExecutorInterface {
 public:
    virtual void execute(TaskCollectionInterface* tci, const ExecutionStrategyInterface& es) = 0;
};

}} // namespaces

#endif // _TASKEXECUTOR_H_

TaskExecutor.cpp

#include "./TaskExecutor.h"
#include "./ExecutionStrategyInterface.h"
#include "./TaskCollectionInterface.h"

namespace mylib { namespace core {

void TaskExecutor::execute(TaskCollectionInterface* tci, const ExecutionStrategyInterface& es) {
    es.execute(tci);
}

}} // namespaces
  • 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-01T14:20:20+00:00Added an answer on June 1, 2026 at 2:20 pm

    This is confusing because you are forward-declaring the class outside the namespace, so you are ending up with two different classes with the same name. You’ll want something like this instead:

    namespace mylib {
      namespace core {
        class TaskCollectionInterface;
        class ExecutionStrategyInterface {
          .
          .
          .
        };
      }
    }
    

    The way you have it now, your execute method is taking a pointer to ::TaskCollectionInterface instead of mylib::core::TaskCollectionInterface.

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

Sidebar

Related Questions

Suppose I have files a.cpp and b.cpp and I get warnings in a.cpp and
Let's assume that I have files a.cpp b.cpp and file c.h. Both of the
I have files in S3 bucket, and their names have the following format: username#file_id#...
Lets say I have files: Libs: one.cpp, one.h two.cpp, two.h three.cpp, three.h Program: program.cpp
I have files that look like the following: >>Start-pattern some text some more text
I have files with the following format: ATOM 3736 CB THR A 486 -6.552
I have files served like so: AJAX request handler -> Include file I would
I have files which have many empty cells which appear as NaNs when I
I have files on the server. Originally their names are readable and users put
I have files a1 a2 a3 b1 b2 b3 and I need to exclude

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.