Why do we needobject oriented programming?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

Why do we needobject oriented programming??

2nd Jan 2022, 6:35 AM
Ravi King
2 Answers
+ 4
OOP is a good approach to transform real world objects into codes. For instance, u can associates a cat in real world ,by assessing its characteristics and behaviours, into a Cat object in codes (like Cat class, with properties like catColor and methods like meow()). The groupings of this elements makes your code more logic, readable and acceptable. Try to look into the OOP concepts, ie Encapsulation, Inheritance & Polymorphism. This will build up your knowledge in OOP and help you progress further.😉 In sololearn, u can learn these in Java course.
2nd Jan 2022, 9:17 AM
Chan Jia Min
Chan Jia Min - avatar
+ 1
We need them to implement flexible relationships within our program. '... is a ...' and '... has a ...' for example are the most common relations. Think of objects as labeled little black boxes of functionality to be used at some point.
2nd Jan 2022, 7:00 AM
Charles Jones
Charles Jones - avatar