How can I implement the following class definition in c++ You will use a struct called Card to model a single card. This

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

How can I implement the following class definition in c++ You will use a struct called Card to model a single card. This

Post by answerhappygod »

How can I implement the following class definition in c++
You will use a struct called Card to model a single card. This
struct will contain a data member to store name of the card (of
type string) and another data member to store its energy (of type
int). Card names can only be single words (no spaces in the name;
this is an assumption). If you want, you can write constructor(s)
for this struct, but that is not needed for the main program.
However, you will not write any member functions for this struct.
The deck of cards will be implemented as a class named Deck. In the
Deck class, there should be two private data members: (i) the cards
inside the deck as a dynamic array of Card struct (i.e. Card
pointer); (ii) the size of this dynamic array, i.e. the number of
cards in the Deck object. It is a must to use such a class
structure with a dynamic array of struct in the homework; you
cannot use any other data structure.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply