-
Array of objects
"Create a 13 element array of Card objects".
Tried typing: Card Hand[13];
Wouldn't work tho. Card is my class, hand is the name of the object i'm trying to create. First time programming in nearly a year and my assignment is already 3 weeks late =(. Any help will be appreciated. Oh and if you need to see any other code to help, just ask, thx.
-
It should work. Did you remember to include the header for your card class? Also did you make a default constructor for the card class? If you will recall when creating an array of objects teh default constructor is called automaticly.
hope this helps
-
Thanks alot, I did forget to include the class header. So when passing the object to functions its just "createNewHand(Hand[13]);"? My teacher wants main.cpp as just a driver of my program, code should be in a seperate file. So i'm declaring and calling my functions in main but i'm writing the code of the functions in a seperate file. Do I need to link main.cpp to bridge.cpp (where my functions are coded) just at compile time? Or do i need to include something at the top of the bridge.cpp function?
-
each file you include with #include is a header file and should have a cpp or c or lib or dll file associated with it that will automatically be linked to the cpp file that has your main(). Only one cpp file per project should have a main().