Saturday, 26 August 2023

OOPS

Class and Object: Spaciman blank form is class and filled form by taking its photocopy   by multiple students is  object 















Inheritance: You can use your mobile and your father's mobile also but your father can not use your mobile. 



Method OverRiding:  Parent and Child class having the function with the same name. 

Parent Child relationship + Riding






Method OverLoading : 

Example 1 : You and your son are going to start dinner. You asked for spoon. knowing that you want to serve rice  from kadhai to plate son will give you a big spoon. if you are going to start eating from your plate he will give you small spoon.  



Example 2 : In the same class there are draw( a,b) , draw(a,b,c) , draw( a,b,c,d) . First funcion will draw a line, second will draw a triangle and the third will draw a rectangle.  


static block: is like a bulb inside the fridge which gets switch on automatically just before you open the fridge door. When the class is loaded static block gets executed at first 


Encapsulation:   public setter and getter methods  and private variables  in one capsule



Constructor: Whenever the doorbell rings, the door gets opened by someone. Whenever an object is created constructor gets executed









No comments:

Post a Comment