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

The Archive Base Latest Questions

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

I have been working on a class and it is all big and ugly

  • 0

I have been working on a class and it is all big and ugly and would like to split each bit into its own cpp/.h files.

I can not seam to work out how to do this…

Here is my code
http://ideone.com/n2Vjb

I understand that you place the class in the .h and the implementation in the .cpp… but I just can not get it to run, where it runs fine in a single file.

  • 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-01T20:38:22+00:00Added an answer on June 1, 2026 at 8:38 pm

    Make sure you don’t forget to put:

    #include "HeaderFile.h"
    

    in the cpp file, where “HeaderFile.h” is the name of the “.h” file containing the definition of the class you want to use in the cpp file.

    If you have a file “MapFrames.h” containing:

    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <stdio.h>
    #include <math.h>
    using namespace std;
    
    class MapFrames{
    public:
        char frame[11];
        vector<short> cols;
        vector<short> rows;
        MapFrames (short a, short b);
    };
    

    then the cpp file “MapFrames.cpp” should contain:

    #include "MapFrames.h"
    
    MapFrames::MapFrames (short a, short b){
        // Construct a vector "rows" of a certain user defined size
        rows.resize(a);
        // Construct a vector "cols" of a certain user defined size
        cols.resize(b);
        //Construct Frames
        frame[0]=201; // Top LC
        frame[1]=205; // Horizontal
        frame[2]=187; // Top RC
        frame[3]=186; // Vertical
        frame[4]=200; // Bottom LC
        frame[5]=188; // Bottom RC
    
        //Construct Icons
        frame[6]=219;  // ICON: Hidden Locations 
        frame[7]=177;  // ICON: Spy Location: Nothing Found
        frame[8]=2;    // ICON: Spy Location: City Found
        frame[9]=127;  // ICON: Miss
        frame[10]=15;  // ICON: Destroyed City
    }
    

    Gerald

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

Sidebar

Related Questions

Maybe its because I have been working all day and I can't see the
I have been working on a project where I have a Worker class that
I have been working on a small exercise for my CIS class and am
I have been working Quartz framework in my grails project with lib called quartz-all-1.7.3.
I have been working on and off on an assignment for my C class
I have been working on some of the projects of my own and dont
I have been working all day but unable to achieve this : It is
I have been working on a demo project all day and everything went just
I have been working on a recursively defined list class in Python and I'm
I have a project I have been working on and all was going well

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.