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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:56:16+00:00 2026-06-19T02:56:16+00:00

I can pass in a Child to a member function expecting a Parent, however

  • 0

I can pass in a Child to a member function expecting a Parent, however when using vectors I get a compile error saying there’s no matching declaration. See the CorrelationEngineManager.cpp call to getUniqueLabels() at the bottom

ServerEvent.h

#ifndef SERVEREVENT_H
#define SERVEREVENT_H

#define SERVEREVENT_COLS 3

#include "Event.h"
#include <vector>


class ServerEvent: public Event {
private:

public: 
    ServerEvent(std::vector<std::string> tokens);
    void print();
};

#endif

Event.h

#ifndef EVENT_H
#define EVENT_H

#include <string>

#define EVENT_STOP 0
#define EVENT_START 1

class Event {
private:

protected:
    double time;
    std::string label;
    int type; // EVENT_START OR EVENT_STOP

public:

};

#endif

CorrelationEngineManager.h

class CorrelationEngineManager {
private:
    std::vector<ServerEvent> s_events;
    std::vector<UPSEvent> u_events;
    std::vector<TimeRecord> s_timeRecords;
    std::vector<TimeRecord> u_timeRecords;
    // typeOfEvent gets type of event, 0 for error, look at #defines for codes
    int typeOfEvent(std::vector<std::string>);
    int createTimeRecords();
    std::vector<std::string> getUniqueLabels(std::vector<Event> events);


public:
    CorrelationEngineManager();
    //~CorrelationEngineManager();
    int addEvent(std::vector<std::string> tokens); //add event given tokens
    void print_events();
};

CorrelationEngineManager.cpp

int CorrelationEngineManager::createTimeRecords() {
    std::vector<std::string> u_sLabels; // unique server labels
    std::vector<std::string> u_uLabels; // unique UPS labels
    u_sLabels = getUniqueLabels(s_events);
//  u_uLabels = getUniqueLabels(u_events);
    return 1;
}
// returns a vector of unique labels, input a vector of events
std::vector<std::string> CorrelationEngineManager::getUniqueLabels(std::vector<Event> events) {

    std::vector<std::string> temp;
    return temp;
}

compile error

 CorrelationEngineManager.cpp: In member function ‘int CorrelationEngineManager::createTimeRecords()’:
 CorrelationEngineManager.cpp:60: error: no matching function for call
 to ‘CorrelationEngineManager::getUniqueLabels(std::vector<ServerEvent,
 std::allocator<ServerEvent> >&)’ CorrelationEngineManager.h:23: note:
 candidates are: std::vector<std::basic_string<char,
 std::char_traits<char>, std::allocator<char> >,
 std::allocator<std::basic_string<char, std::char_traits<char>,
 std::allocator<char> > > >
 CorrelationEngineManager::getUniqueLabels(std::vector<Event,
 std::allocator<Event> >) make: *** [CorrelationEngineManager.o] Error 1
  • 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-19T02:56:16+00:00Added an answer on June 19, 2026 at 2:56 am

    This is not possible in C++, this requires a feature called covariance.

    Even if type A is a subclass of type B, type X<A> is completely unrelated to type X<B>

    Thus you cannot pass std::vector<UPSEvent> to a function expecting std::vector<Event>, since they are unrelated types. Even pass by reference/pointer will not work.

    There are two ways to get around this.

    One would be to make both vectors hold pointers to Event, then they would have identical types.

    The other, would be to make the function a template function, as Daniel suggests.

    You would need to fix the signature as well, as billz points out.

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

Sidebar

Related Questions

Parent loads Child, and wants to pass text string to Child. How can Parent
How we can pass the values from a child window to the parent window
i want to pass the variable from parent to child .How Can i pass
i Hallo, m using MDIContainer. 1. How can i pass the varaible from parent
I know you can pass arguments through the RunWorkerAsync function call when you first
During a search you can pass some data to search manager by using the
Is there any way that I can pass arguments in selector? example: I have
name_iexact keyword is a parameter we can pass to filter function in django.model. Can
When UIViewControllers are instantiated using - (id)initWithNibName:bundle: , you can pass in a bundle.
if I launch a bash script as a child, I can pass its own

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.