Page 1 :
Concepts of Object oriented programming, 1. Objects and Classes, Student, Name, Class, Roll no, Play(), Write(), Talk(), Class Student, {, Name, class, roll_no, //Data, Play(), Write(), Talk() // Methods, }, Musaphir is a student it means that we have created an object or an instance of the class Student., Class Animal, {, Eyes,color,tail // Data, call(), walk() // Methods, }, Dog is an animal., Cat is an animal, Cow is an animal, Horse is an animal, Class fruit, {, Color, taste, size, }, Apple is a fruit, Mango is a fruit, 2. Data Abstraction and Encapsulation, In Java we put everything i.e data and methods inside a class. It becomes a single unit and this, action is called encapsulation., Abstraction means that all the features of the class would be available to the user but the user, wont have any idea what is going on in the background., 3. Inheritance, In biological term inheritance means that getting some features from biological parents. The, features could be anything from facial construct to voice or any diseases as well. Therefore we can, say that the child has inherited the properties and methods of both parents., Class Bird, {
Page 2 :
There are some properties in the class bird, }, Class Flying_bird inherited from bird, {, This class contains the properties of Bird class as well as has its own properties., }, Class Non_flying_bird inherited from bird, {, The class contains the properties of Bird class as well as has its own properties, }, class sparrow inherited from class flying_bird, {, This class contains the properties of both bird and flying bird class and has its own, properties, }, Class penguin inherited from class non_flying_bird, {, This class contains the properties of both class bird and non_flying bird and has it own, properties., }, , BIRD, , FLYING BIRD, , SPARROW, , NON FLYING, BIRD, , PENGUIN, , 4. Polymorphism – Poly means many, morph means changes so Polymorphism means many changes., We have a class called
Page 3 :
Class Shape, {, draw(), }, Class circle inherited from Shape, {, Draw(circle), }, Class rectangle inherited from shape, {, Draw(rectangle), }