+ 4

Why is class called the (factory of objects)?

please suggest đŸ€”đŸ€”đŸ€”đŸ€”

4th May 2018, 4:08 PM
Ujjwal Kumar
Ujjwal Kumar - avatar
3 RĂ©ponses
+ 5
A class is called an object factory because objects are created from a class. An objectis an instance of a class.
4th May 2018, 4:12 PM
Aaron Stone
Aaron Stone - avatar
+ 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
5th May 2018, 9:35 AM
Johannes
Johannes - avatar
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.
7th May 2018, 8:12 PM
Adrian Titiliuc
Adrian Titiliuc - avatar