From 3243105681c58ee7282ba6fd8b68f2ef9aaa8525 Mon Sep 17 00:00:00 2001 From: Ralphie99 <32509775+Ralphie99@users.noreply.github.com> Date: Mon, 22 Oct 2018 16:34:49 +0530 Subject: [PATCH] Added few more lines about OO programming. (#21587) * Added few more lines about OO programming. Hope it'll help. * fix: formatting --- .../design-patterns/object-oriented-programming/index.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/guide/english/design-patterns/object-oriented-programming/index.md b/guide/english/design-patterns/object-oriented-programming/index.md index f241630d50..382bbf27c3 100644 --- a/guide/english/design-patterns/object-oriented-programming/index.md +++ b/guide/english/design-patterns/object-oriented-programming/index.md @@ -23,5 +23,13 @@ Another extremely useful concept is that of inheritance. The idea is that a clas This helps in reusing code and making you rcode structure much more clean. Data hiding is another cool feature. In OO, we have the notion of private and public attributes. Private attributes can be accessed and modified only by methods of that particular class, while public data can be modified from anywhere in the program (within scope obviously). +OO programming represents problem as a real-life statement and thus helps us solve those problems in an effective way. An object in OO programming represents a real-life entity. A class represents a blueprint of a number of objects. An object can be considered as a instance of a class. + +### Example: +See the image below. It represents a blueprint of a class named car. An instance of this class can be a real-life car that performs functionalities such as getFuel(), setSpeed(), drive(), etc. + +![a](https://user-images.githubusercontent.com/32509775/47198274-f25d1680-d388-11e8-8909-44111f747b75.png) + + ## What next? Pick an OO language, and build a basic terminal based game to illustrate these concepts.