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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:26:09+00:00 2026-05-16T15:26:09+00:00

hello i am trying to make a map containing objects as the following :

  • 0

hello i am trying to make a map containing objects as the following : class Employee >>dervied from Employee : are the following classes : Worker , Manager and ViceManage.
in my map i want to have the object Employee sorted by his ID which is char*
i tried to create a map like this:`

multimap<const string,Employee*> t1
t1<string,Employee>::iterator myIterator;
Date e(17,6,1985);
Address a("somecity","somestreet",15,12);
ViceManager* d = new ViceManager("John","Doh","035845778", e,a,"03-9458353",10000,85,"gsdasda");
t1.insert(make_pair(d->GetId(),d));
myIterator=t1.begin();
myIterator->comp_value->PrintEmployee();

i got alot of problems in my code i would very much like to hear what you guys want to say thx 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-16T15:26:10+00:00Added an answer on May 16, 2026 at 3:26 pm

    First of all, iterator is a type which is typedef’ed in multimap template class in your case. So you need to write the following:

    multimap<const string,Employee*>::iterator myIterator;
    

    As for second part of your question, you could add a new field in the Employee class that will identify employee type (Worker , Manager and ViceManage). Then cast depending on that field:

    if ( myIterator->type == VICE_MANAGER ) 
      static_cast<ViceManager*>(*myIterator->second)->PrintEmployee();
    

    If your classes are polymorphic (which is a preferred solution) you could call PrintEmployee without additional cast:

    myIterator->second->PrintEmployee();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 525k
  • Answers 525k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer More (easier?) accessibility to consume government accounting and spending. People… May 16, 2026 at 10:20 pm
  • Editorial Team
    Editorial Team added an answer You should always use full list of columns in your… May 16, 2026 at 10:20 pm
  • Editorial Team
    Editorial Team added an answer i found a few mistakes in your code just by… May 16, 2026 at 10:20 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm trying to make a little Hello World webservice with Django following a few
Hello I am trying to make a terminal type app that is wider than
I'm trying to make a simple hello-world executable python gui app in windows using
I'm trying to make a pop up message box with Hello World written on
http://img804.imageshack.us/img804/4258/uisketch.png Hello, I am trying to a make a UI, like in the sketch
I am trying to make my site fully w3c validator compliant. At the moment,
I'm trying to use jQuery to dynamically create an image map, and I ran
I'm trying to make a simple C# web server that, at this stage, you
I'm trying to make shortcut with javascript. It works with FF but not with
I'm trying to make a JFrame with a usable content area of exactly 500x500.

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.