class definition

This is a discussion on class definition within the C++ Programming forums, part of the General Programming Boards category; Hi, I use C or java mostly, but not C++. , Recently, I must start to write c++ code and ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    16

    class definition

    Hi,

    I use C or java mostly, but not C++. , Recently, I must start to write c++ code and have a question about Class definition.

    I have seen Class are defined in either a header (.h) or an implementation (.cpp) file. Is there general rules or guidelines for where to place a C++ Class? Or, pretty much whatever you want.

    Thanks,

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,744
    A class might be placed into an implementation file if it is supposed to be implementation detail, in which case its definition will likely be in an unnamed namespace. Other than that, class definitions are generally placed in header files.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. class definition error
    By rahulsk1947 in forum C++ Programming
    Replies: 4
    Last Post: 05-16-2009, 11:26 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 06:16 AM
  4. Class Definition?
    By Jamina in forum C++ Programming
    Replies: 4
    Last Post: 08-07-2003, 11:12 PM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM

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