Thread: Function that returns a class...

  1. #16
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Chances are you won't have to write a DLL for a while, so I wouldn't worry about it. It's a much more advanced concept than the ones you're dealing with now.

    Note that the #ifndef SOMEFILE_H type preprocessor directives are used as header include guards. So if you want more information you can look up header include guards.

    I would consider getting a book if you're serious about learning C++. It's harder to cobble together a good knowledge of the language through tutorials. Accelerated C++ might be perfect for you since you have some background in programming and it will highlight the best uses of C++ (as opposed to C or Java).

  2. #17
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by tabstop View Post
    Code goes in .cpp files. Non-code goes in .h files. For this purpose, non-code would be class definitions and function prototypes.
    Ehh, you have to be careful here. Template code, for instance, usually goes in header files because it needs to be accessible to the concrete code which uses it. I don't think anyone would argue that template code is not "code," and yet you find it in header files.

    Most of the code in Boost is in header files, for instance.

    The distinction between headers and modules is a little more difficult to define than that.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  4. Is it possible to have callback function as a class member?
    By Aidman in forum Windows Programming
    Replies: 11
    Last Post: 08-01-2003, 11:45 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM