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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:51:05+00:00 2026-05-16T20:51:05+00:00

hey I i am writing a Program in C++ and for some reason the

  • 0

hey I i am writing a Program in C++ and for some reason the compiler finds errors , and cant find my constructor: here is my class: (inside a h file)

class Adjutancy
{
private:
 vector<Vehicale*,CompareCatId>* m_vehicalesVector;
 map<const string,Base*>* m_baseMap;
 map<const int,City*>* m_citiesMap;
 vector<vector<Distance*>>* m_distancesMatrix;
public:

 Adjutancy(vector<Vehicale*,CompareCatId>* vehicalesVector , map<const string,Base*>* baseMap , map<const int,City*>* citiesMap , vector<vector<Distance*>>* distancesMatrix);
};

and here is my constructor implementation inside a cpp file:
sorry about the length of it.

Adjutancy::Adjutancy(vector<Vehicale*,
  CompareCatId>* vehicalesVector,map<const string,Base*>* baseMap,
  map<const int,City*>* citiesMap,
  vector<vector<Distance*>>* distancesMatrix):
      m_vehicalesVector(vehicalesVector),
      m_baseMap(baseMap),
      m_citiesMap(citiesMap),
      m_distancesMatrix(distancesMatrix)
{}

for some reason inside my main i cant use the constructor.
thanks in advance.

  • 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-16T20:51:06+00:00Added an answer on May 16, 2026 at 8:51 pm

    I suppose you mean this setup:

    // file adjutancy.h
    // ... includes for all classes used below
    // forward declarations are OK for pointers and references
    class Adjutancy
    {
    public:
        Adjutancy(vector<Vehicale*,CompareCatId>* vehicalesVector , map<const string,Base*>* baseMap , map<const int,City*>* citiesMap , vector<vector<Distance*>>* distancesMatrix);
    
    private:
        vector<Vehicale*,CompareCatId>* m_vehicalesVector;
        map<const string,Base*>* m_baseMap;
        map<const int,City*>* m_citiesMap;
        vector<vector<Distance*>>* m_distancesMatrix;
    };
    
    // file adjutancy.cpp
    #include "adjutancy.h"
    Adjutancy::Adjutancy(vector<Vehicale*,CompareCatId>* vehicalesVector,map<const string,Base*>* baseMap,map<const int,City*>* citiesMap,vector<vector<Distance*>>* distancesMatrix)
    :   m_vehicalesVector(vehicalesVector),
        m_baseMap(baseMap),
        m_citiesMap(citiesMap),
        m_distancesMatrix(distancesMatrix)
    {   }
    

    This is horrible code, and for several reasons:

    1. You’re storing a pointer to std::vectors and std::maps in your class: just store the vectors and maps themselves, no pointers needed here. Alternatively, store a reference, but beware of the limitations (no un-initialized reference data members!).
    2. You should avoid template type lists with >>, put a space between the two, or some compilers will misinterpret it as operator>>.
    3. Do not use using statements in your header, instead, use the full namespace prefix.

    I can’t say what’s wrong (everything looks correct at first glance) until you show me your main (complete!) function and how you want to use your constructor.


    Better version:

    // file adjutancy.h
    
    #include <map>
    #include <string>
    #include <vector>
    class Adjutancy
    {
    public:
        Adjutancy( std::vector<Vehicale*,CompareCatId> &vehicalesVector,
                   std::map<const std::string,Base*> &baseMap,
                   std::map<const int,City*> &citiesMap,
                   std::vector<std::vector<Distance*> > &distancesMatrix );
    
    private:
        std::vector<Vehicale*,CompareCatId> &m_vehicalesVector;
        std::map<const std::string,Base*> &m_baseMap;
        std::map<const int,City*> &m_citiesMap;
        std::vector<std::vector<Distance*> > &m_distancesMatrix;
    };
    
    // file adjutancy.cpp
    #include "adjutancy.h"
    
    #include <map>
        using std::map;
    #include <string>
        using std::string;
    #include <vector>
        using std::vector;
    
    Adjutancy::Adjutancy( vector<Vehicale*, CompareCatId> &vehicalesVector,
                          map<const string, Base*> &baseMap,
                          map<const int, City*> &citiesMap,
                          vector<vector<Distance*> > &distancesMatrix )
    :   m_vehicalesVector( vehicalesVector ),
        m_baseMap( baseMap ),
        m_citiesMap( citiesMap ),
        m_distancesMatrix( distancesMatrix )
    {   }
    

    Also remember: “vehicle” is the correct English spelling.

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

Sidebar

Related Questions

Hey folks - I'm writing a pretty simple iPhone application. The data comes from
Hey right now I'm using jQuery and I have some global variables to hold
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey so what I want to do is snag the content for the first
Hey, I'm using Levenshteins algorithm to get distance between source and target string. also
Hey all, my Computational Science course this semester is entirely in Java. I was
Hey, I've been developing an application in the windows console with Java, and want
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my
Hey peoples, I've been studying Java for a couple of weeks, and have decided
Hey, in the Programming Pearls book, there is a source code for setting, clearing

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.