Discussion in 'Programming' started by gkumar, Sep 1, 2009.
How does Java inheritance work?
Like in all other object programming languages. If you have class A that have some public or protected attributes and you create class B that inherit from A then B by B you can access all public attributes of B and A as well and in B you can access protected attributes from A.
Simple sample (because topic is much more complicated i would suggest reading some documentation or tutorials about object programing):
public String Engine; //all our vechicles have some kind of engine
class Bike inherit Vechicle
public bool IsCross;
Next you can use:
Bike honda = new Bike();
honda.Engine = "750";
Hope it will help to start...
Separate names with a comma.