+ 5
What is the difference between objects and constructors ??
4 Réponses
+ 4
Constructors are methods of a class which activate when an object is created. And object is an instance of a class. The object can access the class' functions and/or variables.
+ 4
How do I even do that? Constructor is a method/function in a class that activates when an object is cteated. An object is what calls the methods/functions in the class. Thats pretty much everything about them.
+ 2
Nedas, please elaborate
+ 1
a class is a blueprint for it's objects.
a constructor is a function inside a class which automatically give the objects '''initial values and attributes'''.
so when God created the human class he wrote the class constructor like this.
function __constructor(breed,kill){
breed = this.breed;
kill = this.kill;
}.
because of this there is an Aleppo.