![]() |
How to create program c++?
How to create a base class called MammalClass which each mammal has an age (private data member is Age) and a weight. Also the code for constructors that can instantiate mammals with age 0, a public member function which can set the age of the mammal.
Also include a function called Sound() which outputs "Mammal Sound", Sleep() which outputs "Mammal is sleeping", Eat() which outputs "Mammal is hungry". How to create this program using c++? Thanks a lot for ur all attention..... :) |
What have you tried so far? This is about as basic as it gets, and any book on C++ will cover the syntax necessary to do it.
|
Sounds a lot like a homework problem to me.
|
Probably is a homework problem
first half of the page should have everything that you need http://www.cplusplus.com/doc/tutorial/tut4-1.html |
lol, you think the way the assignment is structured, just read the first 10-30 pages of most c++ programming books and you will have the answers.
|
I wish you would do you're homework yourself, or at least show us that you tried by posting some code. People that post up a homework assignment without trying it themselves first / telling us what problem they are having with their attemp at it... kinda annoys me. Afterall, are you going to ask your co-workers to do your assignments for you when/if you get a job in the industry?
Show us what you have tried, then I'd be glad to assist with any errors you may have. |
A good option would be search over google for a "c++ class template" or "c++ class syntax" or something like that... from your writing i could deduce one or two things... or you wrote the exact assignment as they asked it or you have some knowledge in programming in the theory behind OOP... if the correct one is the latter... the syntax for a class in c++ is all you need.
|
Quote:
welcome to the forums btw :) |
i actually might code this if i get drunk enough (i've only had 5) but yeah, this is exactly the type of crap i was talking about before.
|
Quote:
|
| All times are GMT -5. The time now is 4:17 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC