![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Location: Sarawak,MAlaysia
Posts: 1
Rep Power: 0
![]() |
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..... ![]() |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Dec 2004
Posts: 35
Rep Power: 0
![]() |
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.
|
|
|
|
|
|
#3 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
Sounds a lot like a homework problem to me.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4
![]() |
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 |
|
|
|
|
|
#5 |
|
Programming Guru
![]() |
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.
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() ![]() |
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.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#7 |
|
Programmer
Join Date: Jan 2005
Location: Bayamon, Puerto Rico
Posts: 71
Rep Power: 4
![]() |
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.
__________________
"God bless u all" :) |
|
|
|
|
|
#8 | |
|
Expert Programmer
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 548
Rep Power: 4
![]() |
Quote:
![]() welcome to the forums btw ![]()
__________________
Johnny was a chemist's son but Johnny is no more, for what Johnny thought was H2O was H2SO4 |
|
|
|
|
|
|
#9 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
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.
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
|
|
#10 | |
|
Hobbyist Programmer
Join Date: Dec 2004
Location: a cardboard box
Posts: 118
Rep Power: 4
![]() |
Quote:
__________________
... |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|