+ 4
Why is class called the (factory of objects)?
please suggest 🤔🤔🤔🤔
3 Antworten
+ 5
A class is called an object factory because objects are created from a class. An objectis an instance of a class.
+ 2
Because with a class you can create many objects without writing much code. Like in a factory, objects can be mass-produced. Really useful in games, when you want to create 1000 monsters from scratch.
https://code.sololearn.com/cjNkd8F0FSVB/?ref=app
0
A class is the base of an object, in a class you're describing anything about your wanted object.
Take for example class Animal where you describe things like number of legs or the sound it makes and therefor.