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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:01:02+00:00 2026-06-01T07:01:02+00:00

For a school assignment I have to create a C++ program that will create

  • 0

For a school assignment I have to create a C++ program that will create and manage a binary flat file database containing students and undergrad students. The undergrad students are basically the same as normal students, but with some added fields. A given hint is that we could use templates.

My problem is in structuring this design. I’ve tried the following:

  • Creating a Person class containing string variables with a student and an undergrad class that inherit from it and add more variables for fields. This works but it becomes very hard to add more types of people later on, so I tried:
  • Creating a Person class that contains a map<string, string> from which Undergrad and Student inherit, and a database class containing a vector<Person> to which those are added. In the Person::map<string, string> I added the different fields and their values, like name, address etc.

I’m not sure if I’m going the right way with this. Is there a standard design pattern that’s used for things like this?

  • 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-01T07:01:03+00:00Added an answer on June 1, 2026 at 7:01 am

    The correct approach depends more on what you need the system to do. Your first approach is more standard c++ architecture if you know the system will be specialized around the requirements you’ve listed and you want better runtime performance.

    The map way would allow you to implement a more generalized approach, but at a cost of clarity, specialized accessors, and more so I’m guessing it is not the approach your teacher is seeking.

    If you know all the requirements of the system ( what kind of queries will be made, what is it expected to support, etc ) it will better inform your decision, so you should get clarity on that for sure.

    Good luck!

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

Sidebar

Related Questions

So I have an assignment for school that requires me to create a fixed
I currently have a school assignment that involves both PHP and asp.net. Now the
For a database assignment I have to model a system for a school. Part
We have to create an application for iPhone and Android as a school assignment.
I have an assignment at school to build a webserver that handles GET/HEAD/PUT requests,
I have a school assignment where I need to create a data-driven style of
i have an erd for a school assignment that contains a many to many
I am creating a file server application for school assignment. What I currently have
For an assignment at school, we have to use structs to make matrices that
For a school assignment I have to make a connection to a database from

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.