+ 241

Some real life Examples of Object-oriented programming (OOP) concept.

1 .Polymorphism : The process of representing one form in multiple forms is known as Polymorphism. Example - Suppose if you are in class room that time you behave like a student, when you are in market at that time you behave like a customer, when you at your home at that time you behave like a son or daughter, Here one person present in different-different behaviors. READ MORE - https://code.sololearn.com/ceBPn5x7VRfD/?ref=app

10th Mar 2017, 7:43 AM
Rashmi Ranjan Bisoi
Rashmi Ranjan Bisoi - avatar
91 Antworten
+ 35
Inheritance Inheritance is a way to reuse once written code again and again. The class which is inherited is called base calls & the class which inherits is called derived class. So when, a derived class inherits a base class, the derived class can use all the functions which are defined in base class, hence making code reusable.
26th Jun 2017, 8:58 AM
ⓢⓐⓝⓓⓔⓔⓟ
ⓢⓐⓝⓓⓔⓔⓟ - avatar
+ 46
Thanks for these great explanations! :)
14th Mar 2017, 8:22 PM
Gami
Gami - avatar
+ 18
Thanks for such explanations!!
13th Mar 2017, 10:12 PM
Nyandago
Nyandago - avatar
+ 17
Ok so now I have take time to read :) I feel programming should be teach that way and everyone in the world could develop an OS :D Great post, thanx!
10th Mar 2017, 11:37 AM
Geoffrey L
Geoffrey L - avatar
+ 16
The common example for polymorphism often given "your behavior different with different people or at different places" is not really right. It is an example that is demonstrating overloading. Overloading is same interface (name) different input data hence different output. If you take behavior example, you behave differently at school, work and home. What is common here is behave, so it is an interface. When input is school, behave has one output as you (object) behave as certain way at school. When input is work, behave has another output as you behave different at work. When input is home, behave has yet another output. Three cases have three different output because the input is different, but the interface (behave) is same and more importantly there is only one object (you). Technically polymorphism is one interface different behavior due to different objects of similar/related type. Good example of polymorphism in real life, in an exam paper, each student writes a different answer to a same question (assuming question requires descriptive answer). Here there is only one interface, a question in the exam paper. It has different behavior (answers) due to different objects (students) of similar/related type (human).
9th Jun 2017, 9:12 PM
NeutronStar
NeutronStar - avatar
+ 12
Q)  What is avirtual function? ANS:. Virtual function is a member function ofclass and its functionality can be overridden in its derived class. This function can be implemented by using a keyword called virtual, and it can be given during function declaration. Virtual function can be achieved in C++, and it can be achieved in C Languageby using function pointers or pointers to function.
26th Jun 2017, 9:00 AM
ⓢⓐⓝⓓⓔⓔⓟ
ⓢⓐⓝⓓⓔⓔⓟ - avatar
+ 10
Let us begin expressing a 'Human' object in C++, with a 'name' attribute. The following code includes things I haven't introduced yet, but you may be able to understand the fundamental concept of what is going on given the words used. They will be explained afterwards. class Human { private: std::string nameC; public: Human(const std::string & name) : nameC(name) { } }; The first new thing you will notice when reading from top to bottom is the opening brace ({). Braces are the main way to delineate objects and 'scopes' to the compiler. In this case everything between the opening brace and closing brace (the one with the ";" after it) is the definition of the 'Human' class.
26th Jun 2017, 8:54 AM
ⓢⓐⓝⓓⓔⓔⓟ
ⓢⓐⓝⓓⓔⓔⓟ - avatar
+ 9
Thank you and great concepts, and again thanks😉😌
9th Jun 2017, 7:12 PM
Zafar Ali Birhamani
Zafar Ali Birhamani - avatar
+ 9
good. really helpful 👍👌👌👍 thanks.
27th Jun 2017, 10:47 AM
Sahil Choudhary
Sahil Choudhary - avatar
+ 8
12 polymorphism Process of representing one form in many ways. Example Your behavior that is, u behave differently with different person in different place I mean, to parents I'll be good son, and to a friend u r a buddy and u share things with him /her and to teachers u show some respect . Here it behavior is goes on changing with people u meet. 2:abstraction Process of showing essential information to user and hide the rest Example : Think u have a car, and u are riding car now, when u apply break u know that car gone a stop but u don't know what is the process happened when u applied break
17th Mar 2017, 9:21 AM
Mahesh Sd
Mahesh Sd - avatar
+ 8
Great Examples
4th Jun 2017, 3:11 PM
Luyanda
Luyanda - avatar
+ 7
Really great analogy mate, first time I get a bit of insight into OOP
12th Mar 2017, 5:01 PM
Fabiano
Fabiano - avatar
+ 7
Great allusions.
4th Jun 2017, 2:43 PM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar
+ 7
thanks @Rashmi...helped a lot!!!
9th Jun 2017, 8:05 AM
ElricTheCoder
ElricTheCoder - avatar
+ 7
@raqshandra ... En- means "within" or "in" (so encircle..."in a circle"), and "capsule": a type of container Astronauts traveled inside a space capsule. Fish oil, medicine, etc comes in capsules. Capsules completely surround (contain) things by "encapsulating" them. When you want what's inside, you must access the 'encapsulating layer' first.
12th Jun 2017, 6:13 PM
Kirk Schafer
Kirk Schafer - avatar
+ 7
Thanks dude... The illustrations are perfect!
13th Jun 2017, 9:28 PM
Aina Oluwafemi
Aina Oluwafemi - avatar
+ 6
Thanks Rashmi for such a wonderful explanation I need to know how we use this concept in programming. There is interface,abstract class, static class and final class. Many people do not know how to use this concept and why? What are advantages and how this concept make our life happy in programming I hope you understand my doubt regarding prove concept by practically rather than theortical
20th Mar 2017, 5:14 AM
Akash Butani
Akash Butani - avatar
+ 6
excellent explanations
12th Jun 2017, 4:49 AM
Gourav raghuwanshi
Gourav raghuwanshi - avatar
+ 6
I started programming in Perl and then some C. I made heavy use of multi-dimensional arrays to store large amounts of data. Then when I came to Python, PHP and Java I really learned to like the OOP approach to programming, making it more easily to handle data, not having to remember the structure of multidimensional arrays. Now, I just had to think what disadvantages OOP has. What do you think? Let's distinguish two sorts of disadvantages: OO is often provided through such imperfect vehicles as C++ and Java [discuss their defects]; and OO is inapplicable because [explain many mismatches].
13th Jun 2017, 6:02 AM
ⓢⓐⓝⓓⓔⓔⓟ
ⓢⓐⓝⓓⓔⓔⓟ - avatar
+ 5
Well done...... Thx. ...... ...... But I want you to Share your idea in this new question: https://www.sololearn.com/discuss/453837/?ref=app
9th Jun 2017, 6:28 AM
BENOTMANE
BENOTMANE - avatar