Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   How to create program c++? (http://www.programmingforums.org/showthread.php?t=1880)

Alice_T Jan 17th, 2005 9:33 AM

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..... :)

Tama Jan 17th, 2005 5:16 PM

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.

Mjordan2nd Jan 17th, 2005 5:29 PM

Sounds a lot like a homework problem to me.

Xero Jan 17th, 2005 5:44 PM

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

Berto Jan 18th, 2005 3:56 AM

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.

Infinite Recursion Jan 18th, 2005 8:27 AM

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.

codetaino Jan 18th, 2005 10:06 PM

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.

Benoit Jan 19th, 2005 5:28 AM

Quote:

Originally Posted by Alice_T
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..... :)

This sounds a lot like a homework assignment...Around here you gotta attempt it first and show us what you got before we help you....That way you'll learn more :)

welcome to the forums btw :)

bl00dninja Jan 19th, 2005 2:56 PM

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.

Xero Jan 19th, 2005 3:10 PM

Quote:

Originally Posted by bl00dninja
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.

You can't get drunk off water. Nice try though.


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