object oriented programming क्या है ?

Object oriented programming 

  आप अपने चारों ओर देखते है तो आपको क्या दिखाई देता है । objects दिखेंगे हेना तो आपके पास phone होगा । phone क्या है । object है । आप bike को देखो bike क्या है object है । आप भी एक object हो । जो भी आप देखते हो वो एक object है तो इन object को आपको programming world मैं represent करना हो तो मतलब हमारा task क्या है programming से ताकि हम real world entities के साथ काम कर सके हेना 

  ओर वही object oriented programming आती है । 

तो object-oriented programming मैं दो important concepts आते है जिसका नाम है classes or objects .
Object क्या है । ये अभी हमने समझ लिया अब classes क्या है ये समझते है 

Class 
   Class is a template / blue print for real world entities . 

हम एक real world entities को लेते है phone को तो उस real world entities का blue print हम लोग class बोलते है । तो class के दो important features है वो क्या है । वो है properties or behavior 

    तो phone की properties क्या हो गयी phone के पास एक color होता है उसका एक cost होता है , उसकी एक battery life होती है । 
    ओर उस phone का कुछ behavior होगा उस phone के साथ आप कुछ task कर सकते हो , तो phone के साथ आप calls कर सकते हो , videos देख सकते हो , गेम्स खेल सकते हो । 
   तो आप properties or behavior को एक बक्से मैं बन्द कर देते हो , तो उस बक्से को आप class बोलते हो । 
  तो class को python मैं या किसी programming language मैं represent करे तो वो क्या होगा । 
  
  Class is a user defined data type 

जैसे हमने inbuild data type देखे है int , float , boolean , structure right  । तो उसी तरह class in python is a user defined data type . 
   तो यहां पर हमारा मोबाइल है ये user defined data type है तो उस user defined data type के अंदर attributes or method होता है ।
   Attributes जो है properties है जैसे color हो गया , cost हो गया ।
 Method  जो भी behavioures है उस user defined data type का या फिर उस class का ये सब methods हो गया । 
   तो आप phone से गेम भी खेल सकते हो और call भी कर सकते हो ये क्या हो गया एक method हो गया 
   तो ये class हो गया

अब समझते है object क्या है with respect to programming language or with respect to Python 
    Object are specific instances of a class  
  तो इसका मतलब ये है कि आप कोई general tamplet को लेके कोई specific object बमते हो उसको object कहते है । 

   तो class हमारा phone है यहा पे तो उस phone के आप कोई specific instance's लेते हो जैसे apple phone , Motorola phone , Samsung phone etc . 

  Apple is a specific instance of a phone 
Motorola is a specific instance of a phone 
Samsung is a specific instance of a phone 

ओर जब आप इन तीनो Specific instant को लेते हो तो ये क्या है ।  Object है । तो इस object को हम inbuild data type से compare करते है 

जैसे आप देख रहे हो a =10,b=20 , c=30  तो यह पे हम क्या कर रहे है कोई data type है उस data types मैं हम value add कर रहे है उसी तरह हमारा user define data type क्या है mobile है उस mobile के हम लोग object creat कर रहे है और object क्या है 
Apple , Motorola , Samsung । ये आपको थोड़ा सा confusing लग सकता है तो जब आप coding करेंगे तो आपका पूरा concept clear हो जाएगा । 
     तो object oriented programming का idea ये है 

   तो जो भी आप real world entities देख रहे हो वो सब object है और उन object को अगर आप programming world मैं represent करना है तो that is where you would require object oriented programming and class क्या है class जो है basic template है in real world entities का ओर जब आप ये templates लेते हो blue print लेते हो और उसका कोई एक specific instances बनाते हो आपको object मिल जाता है । 

Post a Comment

0 Comments