Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. add class to a project

add class to a project

Scheduled Pinned Locked Moved C / C++ / MFC
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    suroor453
    wrote on last edited by
    #1

    I have download a demo console applic. from this site,but I want to add it to my project(console applic.) as a class

    D 1 Reply Last reply
    0
    • S suroor453

      I have download a demo console applic. from this site,but I want to add it to my project(console applic.) as a class

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Ok, so what do you need help with?


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      S 1 Reply Last reply
      0
      • D David Crow

        Ok, so what do you need help with?


        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

        S Offline
        S Offline
        suroor453
        wrote on last edited by
        #3

        how can I add this console app. to my project as a class????!!!!

        D T 2 Replies Last reply
        0
        • S suroor453

          how can I add this console app. to my project as a class????!!!!

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          There is no one-to-one correlation between a file/app and class. A class should be thought of as an autonomous object. You will need to go through the application, probably several times, and figure out what parts can be put into their own class. You may end up with one large class (hopefully this won't be the case as large classes are unproductive), or you may end up with dozens of smaller classes. As a very primitive example, how would you turn the following application into one or more classes:

          #include <stdio.h>

          void main( void )
          {
          printf("Hello World\n");
          }


          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

          1 Reply Last reply
          0
          • S suroor453

            how can I add this console app. to my project as a class????!!!!

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            david told the most, but you could do this. is the source is well written, it is probable that its author put his class declaration into a whole header file (h, hpp, hxx, hh), and the implementation into a module file (cpp, cc, cxx). if so, just import those 2 files into your workspace (VC++6) or project (VC++7 and later) if he didn't, extract the classe by yourself and paste it into a new file of your own in your solution (but i doubt you'll have to do that).


            TOXCCT >>> GEII power
            [toxcct][VisualCalc]

            S 1 Reply Last reply
            0
            • T toxcct

              david told the most, but you could do this. is the source is well written, it is probable that its author put his class declaration into a whole header file (h, hpp, hxx, hh), and the implementation into a module file (cpp, cc, cxx). if so, just import those 2 files into your workspace (VC++6) or project (VC++7 and later) if he didn't, extract the classe by yourself and paste it into a new file of your own in your solution (but i doubt you'll have to do that).


              TOXCCT >>> GEII power
              [toxcct][VisualCalc]

              S Offline
              S Offline
              suroor453
              wrote on last edited by
              #6

              there are 3 header files and 2 module files(.cpp) how can I import these files to my workspace(I'm using VC++ 6)

              T 1 Reply Last reply
              0
              • S suroor453

                there are 3 header files and 2 module files(.cpp) how can I import these files to my workspace(I'm using VC++ 6)

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                you copy the files into the directory your source files are created (into windows explorer). then, you go into your workspace (workspace tab), and right click the project item -> add existing files to project... and choose the files you've just copied... the header will appear in the header folder, and the c files in the source folder...


                TOXCCT >>> GEII power
                [toxcct][VisualCalc]

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups