Results 1 to 5 of 5

Thread: Help Please

  1. #1

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Help Please

    I have a class (lets say Stable) that takes an object of another class (Horse) as a parameter.

    So I would have something like this in my header and implementation files....

    void GetSomeInfo (Horse &t){}

    Easy enough, but when I try to compile ,it doesn't recognize Horse.

    So, I figured, well, I need to throw a #INCLUDE "horse.h", in the Stable header file, so the stable class would recognize what a horse was. Well, that doesn't work... (it dont recognize it)...

    So how can I get one user defined class(Stable) to recognize another user defined class(Horse), so I can implement functions that a Horse object as a parameter.

    Im using VC++ btw....

  2. #2
    Zaei
    Guest
    You must include "horse.h" ABOVE the declaration of "Stable", or it wont work.

    Z.

  3. #3

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    yeah I've been doin that... it didn't help....

    :\windows\desktop\student.h(14) : error C2629: unexpected 'class Student ('
    c:\windows\desktop\student.h(14) : error C2238: unexpected token(s) preceding ';'
    class

    thats what happens when i try to compile it... thanks anyway.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    probably syntax errors or something like that.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Code:
    :\windows\desktop\student.h(14) : error C2629: unexpected 'class Student ('
    Try using braces rather than parentheses...
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width