I figured out my other problem, but...

This is a discussion on I figured out my other problem, but... within the C++ Programming forums, part of the General Programming Boards category; Yeah, it's not real specific about defining functions though. In fact, none of the examples in the book show defining ...

  1. #16
    Registered User
    Join Date
    Mar 2003
    Posts
    72
    Yeah, it's not real specific about defining functions though. In fact, none of the examples in the book show defining the functions or making a seperate .cpp in addition to the .h file for the class. The book is entitled "C++ Program Design" by James Cohoon and Jack Davidson. It looks like it was originally published back in '97..

  2. #17
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    I'm still wondering how you decided what type of project to create? You can't just randomly pick a type. Different types of programs are organized differently, and the compiler needs to know what type of program it's looking at. Windows programs(=programs that use windows to interact with the user)are totally different than console programs, which don't have a windows interface.

    A windows program has two functions: WinMain() and WindowProc() which are seemingly unconnected. The Windows operating system serves to form the connection between the two. In a console program, there is one function called main() which is the kick off point for your program, and other functions are called from within main().

    "I haven't actually done a whole heckuva lot in terms of functions in C++ yet though, but I have dealt with functions of course quite often in the other languages, so I have to figure it to be similar..."

    I'm not sure it works that way. You have to implement functions in a specific way in C++ or else the program won't compile.

    As for classes in general, you have to start learning about them with simple examples, and then you have to learn about constructors, destructors, copy constructors, and assignment operators and how they are affected by the types of your data members and function definitions.

    "In fact, none of the examples in the book show defining the functions or making a seperate .cpp in addition to the .h file for the class."

    Most beginning C++ books start off with function definitions in the same file as main(). Then after you learn where they can positioned in the main() file, you learn to separate them into separate files.
    Last edited by 7stud; 04-23-2003 at 12:01 AM.

  3. #18
    Registered User
    Join Date
    Mar 2003
    Posts
    72
    That totally makes sense.. I appreciate you all taking the time to respond to my questions... Can anyone suggest a good C++ book that I might be able to buy or borrow from the library that would discuss classes and functions a bit better? Or even a website? I think part of my problem is that this book doesn't seem all that great when compared to other programming books that I've read. I've read and re-read this chapter on classes at least 5 times and it still isn't quite sinking in... maybe it's just user error?

  4. #19
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    Ivor Horton's Beginning C++

    If you want to eventually learn about windows programming(=programs that use windows to interface with the user) using MFC(=a library of classes that spare you from having to reinvent the wheel), then get Ivor Horton's Beginning Visual C++ 6, in which the first 12 chapters are a C++ tutorial, and the second half of the book moves into windows programming with MFC.
    Last edited by 7stud; 04-23-2003 at 12:08 AM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  4. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  5. problem with output
    By Garfield in forum C Programming
    Replies: 2
    Last Post: 11-18-2001, 08:34 PM

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