Page 100 - ComputerScience_Class_11
P. 100

In programming, a class ‘Car’ inherits its properties from the class ‘Motor Driven’ that inherits some of its properties
              from another class ‘Vehicle’.
              While developing a code, there may be a requirement to create more than one class. Under such a situation, we may
              share the data members and methods of one class with another class. This helps to reduce the coding as well as the
              complexity of the programs. This is the concept of reusability.


                                                             Definition
                    Inheritance is the method which allows one class to inherit the properties (data members and member methods)
                    of another class.



              Essential terms related to inheritance are as follows:

              •  Superclass: A class from which another class inherits its features is called a superclass. It is also known as a base
                 class or parent class.
              •  Subclass: A class that inherits the features of a parent class is called a subclass. It is also called a derived class or
                 extended class or child class. Apart from features of the base class, it may have its own data members and methods.

              4.2.4 Polymorphism
              The word Polymorphism comes from the  Greek  vocabulary
              meaning "many forms" ("poly" means many and "morphe"
              means form). This is the last pillar of OOP’s principle. It is an
              ability of an object or a variable to exist and get processed in
              more than one forms. A real-life example of Polymorphism is
              demonstrated as shown in the figure.

              A man may be an employee in an office, a father of a child,
              a customer in a shop and may also be a tourist while visiting
              a place.

              Polymorphism is the capability of a reference variable to alter
              its characteristics and behaviour according to what object it
              is having. It allows multiple objects of different subclasses to
              be treated as objects of a single superclass, while automatically selecting the proper methods to apply to a particular
              object based on the subclass it belongs to. Polymorphism is the concept that allows an object of a class to behave
              differently in response to a message or an action.


                                                             Definition

                    Polymorphism is the feature of being able to allot a dissimilar meaning so that a variable, a method or an object
                    can have more than one form.



                  4.3 HISTORY OF JAVA
              Sun Microsystems, Inc. developed Java in 1991 with the help of James Gosling and Patrick Naughton. It was first released
              in 1995. Basically, it was designed for small embedded systems used in digital appliances like washing machines, set-
              top boxes, etc. But later on, its uses increased and currently, it is used for Internet programming, gaming, electronic
              business, mobiles, etc. Thus, it has a variety of uses in real life. Since it is machine-independent and uses object-
              oriented technology, it is used in web technology.





                   98  Touchpad Computer Science (Ver. 3.0)-XI
   95   96   97   98   99   100   101   102   103   104   105