What are the advantages of oop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What are the advantages of oop

3rd Mar 2018, 2:37 PM
Atul Sati
Atul Sati - avatar
2 Answers
+ 4
supposs you are making a game... in which each type-a enemy has 1) 500 hit points 2) 40 damage fireball 3) 60 damage thunder attack 4) 10 damage handpower 5) 2 min auto refill of half hitpoints 6) whenever dies produces small enemy of some hitpoints...damage.. now the game suppose to have a loooooottttttt of enemy not just type a...typs b,c,d,... each having such diff. properties so what would u do.. declare each enemy variable and assign them again & again??? make a class-- make some variables and methods initialising such properties.. now any obj of that type of class will inherit the perental properties... and your game just hit 9 billion downloads... //##20% profit is mine okkk //heres my acc. no. 560XX90XX8X
3rd Mar 2018, 3:28 PM
sayan chandra
sayan chandra - avatar