The human body has many organs (heart, lungs, brain, and kidney, to name a few). We could think of the human body as complex object made up of simpler objects (organ).
a) Create classes for heart and brain. Think about what the functions of the heart and brain are in our body and map these functions into methods.
b) Create an organ class as the base class for the organs and derive the classes created earlier from the base class.
inaxassan
0
Newbie Poster
Recommended Answers
Jump to PostI really don't want to sound rude, or like I don't want to help people understant the basics of programming (which I do), but you should probably make an attempt at it before expecting people to just hand you the answers. You haven't even mentioned what part is troubling you.
Jump to PostYou should have a base class called
organ
. You should also have two other classes calledbrain
andheart
, which inherit functionality from theorgan
class (because both of them are organs).Basically, for every function the brain or heart carries out, create that function inside the appropriate class. If …
All 7 Replies
gavinflud
14
Light Poster
inaxassan
0
Newbie Poster
gavinflud
14
Light Poster
Ene Uran
638
Posting Virtuoso
inaxassan
0
Newbie Poster
inaxassan
0
Newbie Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.