+ 2

Object and classes vs functions

What's the difference between function and object & classes ?? And why it is recommended or important to use oops concept??!

16th Dec 2018, 7:50 AM
Prateek Shourya
Prateek Shourya - avatar
1 Odpowiedź
+ 5
Function is a block of code to execute Object is a variable represent something that can hold value and do something Class is the structure/blueprint of an object Sometimes you'll encounter problem like you need multiple value for each of variable. For example a person with name and age. Without oop you'll need to do this name=["a","b"] age=[18,28] Then identify each person's age using match index, what if there are more than 10 attribute ? Write 10 array ? What if more ? It'll get harder and harder. In OOP, you only need 1 array of an object, but it covers every variable the person need to have person[6].age
16th Dec 2018, 8:33 AM
Taste
Taste - avatar