this is my first post so sorry if i did it wrong lol. Im new ist to c++ and for my uni course we have to construct a deck of card with a build_deck function. I managed to get the function working but when i try to test it ( by calling the function in a main() ) i get the error cannot call member function 'void Deck::build_deck() without object. Here is the function and me trying to test it. Thanks in advance :).
Replace bradw's 3rd line with whatever constructor you wish to use. I see you have on with an int as argument, so just use that one. Deck myDeck(<someint>);
I suggest you read the documentation, header, or constructor code to find out what the value it wants represents. I suspect it would be the number of cards, but it could be the number of Decks, or anything else.
I really have no idea what the Deck class does, so you should look it over so you know how to use it properly. I can only expect you will continue to run in to problems until you do. Maybe it came with some kind of example/sample usage.
Thanks guys, ill let you know what happens when i can, i have to use the university computers as they are running linux (gnome i think) and it compiles fine on their machines. but my laptop i use dev c++ and that throws up loads of errors when i compile ( even though the code's fine ) and code blocks also gives me errors :/
bradw said:
Maybe it came with some kind of example/sample usage.
It doesn't come with an example as i wrote the full code :/