Inheritance

  

1st Generation car...

    

    

            Drive

            Breake

            Reverse




New Generation car...


           Drive

           Breake

           Reverse

           Flying

           Surf



Adding Things That Have One Property To Another Property Is Inheritance. And It Is Possible To Inherit Things From One Thing To Another.

 According to the diagram above, the new generation has the same things as the 1st generation. But the new one has more modern equipment than the old one. Compared to the 1st generation, the new generation is cuter and more advanced in terms of design. 


Ex : Class car () {                                                  Ex : Class car () {

        void drive () {                                                        void drive () {

        }                                                                             }

        void breake () {                                                      void breake () {

        }                                                                             }

        void reverse () {                                                      void revese () {

        }                                                                             }

        }                                                                               void flying () {

                                                                                       }

                                                                                          void surf () {

                                                                                       }


                                                                                                                                                 D.M.T. Dasanayaka
                                                                                                                                                 Software Engineer
                                                                                                                                                 Java Development.

Comments