Hard to understand "Inheritance"

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2006
Posts: 24
Reputation: jitterson is an unknown quantity at this point 
Solved Threads: 1
jitterson jitterson is offline Offline
Newbie Poster

Hard to understand "Inheritance"

 
0
  #1
Jul 1st, 2006
I have hard time understaning of what is Inheritance?

Can someone help on this?
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: Hard to understand "Inheritance"

 
0
  #2
Jul 1st, 2006
What do you mean by inheritance in real life? The child gets what his parents have if they let him have it. That is the same in programming too.

If you have a class A, whose child is class B, class B gets the things class A that has been declared public or protected by the programmer. Anything declared private will not be inherited.
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 147
Reputation: Laiq Ahmed will become famous soon enough Laiq Ahmed will become famous soon enough 
Solved Threads: 20
Laiq Ahmed Laiq Ahmed is offline Offline
Junior Poster

Re: Hard to understand "Inheritance"

 
0
  #3
Jul 3rd, 2006
Inheritance simply means Reusing the Interface of the base class. Two classes have something in common for example consider the following example. There are two classess Shape(a base/parent class) and Circle(a derived/child class ) you might have guessed there is some relationship between shape and Circle. Every shape has color including circle. So if we make the interface of the shape and inherit the interface of the shape class to circle we just need to mention the information specific to Circle



class Shape {
public:
void draw();
void fill_color();

};

//inheritance syntax
class Shape: public Shape {
public:
void Set_radius();
private:
size_t radius;
};

This is the simplest information i can provide hope you got the basic idea....
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 89
Reputation: dilip.mathews is an unknown quantity at this point 
Solved Threads: 3
dilip.mathews's Avatar
dilip.mathews dilip.mathews is offline Offline
Junior Poster in Training

Re: Hard to understand "Inheritance"

 
0
  #4
Jul 3rd, 2006
Y dont u search in web. U can get tons of material related to inheritance.
Just give the string "Inheritance tutorials"(google)
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 24
Reputation: jitterson is an unknown quantity at this point 
Solved Threads: 1
jitterson jitterson is offline Offline
Newbie Poster

Re: Hard to understand "Inheritance"

 
0
  #5
Jul 5th, 2006
Thank you all for your prompted reply. I got it.
Jitterson
"For all your job search and Hi Tech needs visit"
www.cuilltube.com
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC