Jump to content

C++ Classes help

ExplOregon

I am stuck on the concept of classes currently.  Frankly I have no idea what code to implement into main

Here's a screencap of what I have so far, if you need more of my code I can put it in pastebin, any help

is greatly appreciated. 

http://imgur.com/2tw9pPs

Link to comment
Share on other sites

Link to post
Share on other sites

You don't need prototypes before the class in (what I assume is) testing.h (window on the left). You may want a private array of animals in the animalShelter class to hold information to search for. Also, you may want to define the stuct animal separately from the class.

 

Think of classes like a box and that box has compartments. Some are functions, others just store data.

Link to comment
Share on other sites

Link to post
Share on other sites

44 minutes ago, mkylem said:

You don't need prototypes before the class in (what I assume is) testing.h (window on the left). You may want a private array of animals in the animalShelter class to hold information to search for. Also, you may want to define the stuct animal separately from the class.

 

Think of classes like a box and that box has compartments. Some are functions, others just store data.

Those prototypes are actually gone now, forgot to say that.  They were there for testing purposes. But, that still does not address what goes in main

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, ExplOregon said:

Those prototypes are actually gone now, forgot to say that.  They were there for testing purposes. But, that still does not address what goes in main

A couple of loops, inputs for characters, and outputs requesting what the user wants to look for and something to initialize and assign values to the animal array for animals to search for. It all depends on what your assignment is but I don't have all of that information.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, mkylem said:

A couple of loops, inputs for characters, and outputs requesting what the user wants to look for and something to initialize and assign values to the animal array for animals to search for. It all depends on what your assignment is but I don't have all of that information.

Something like what I have in main in the far left one?

http://imgur.com/xjBLCZd

Link to comment
Share on other sites

Link to post
Share on other sites

23 minutes ago, ExplOregon said:

Something like what I have in main in the far left one?

http://imgur.com/xjBLCZd

Yes, though it would be helpful to see what displayMenu() had to output. You should probably have two parameters for search(), one being for what kind of info they want to search for (age, name, weight, etc.) and the actual info they're using to search.

 

Also make sure that the * for pointer allocation is being used consistently throughout the program. Just a formatting thing for pleasantness.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×