code seperation

This is a discussion on code seperation within the C++ Programming forums, part of the General Programming Boards category; i was wondering if someone could seperate this code into sections that i could put into different files. My program ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    91

    code seperation

    i was wondering if someone could seperate this code into sections that i could put into different files.
    My program is quite long, and i dont want to keep all the classes in one file.
    Could someone help me seperate it like..
    Printable class file
    Printable header file
    Person Class file
    Person header file
    Main file
    ?
    i think this would be the best way to seperate my one big file..

    Code:
    #include <iostream>
    using namespace std;
    
    class Printable
    {
      public:
        virtual ~Printable( ) { }
        virtual void print( ostream & out = cout ) const = 0;
    };
    
    class Person : public Printable, public Serializable
    {
      public:
        void print( ostream & out = cout ) const
          { out << "printing a Person" << endl; }
    };
    
    int main()
    {
         Person p;
    
    }

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    maybe this faq entry can help you a bit
    http://faq.cprogramming.com/cgi-bin/...&id=1043284392

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 09:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 08:34 AM
  3. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 11:20 AM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21