+ 6

What do you mean by instantiation an object? Representing??????!

please help me with vocabulary

22nd Feb 2018, 9:37 AM
Jay Jay
Jay Jay - avatar
2 Réponses
+ 5
Imagine you have a class for example a class of dogs. I'm gonna write it in C# but it's only a matter syntax: class Dog { string type; int height; int weight; public Dog(string t, int h, int w) { string type = t; int height = h; int weight = w; } } Now you can instantiate am object of the dog class, for example you want to have a golden retriever: Dog golden = new Dog("Golden Retriever", 92, 40); As you can see golden is a dog object, an instance of the dog class, the dog class's constructor takes some arguments: the type of the dog, the height and the weight, thus different and different kind of dogs can be instantiated.
22nd Feb 2018, 9:45 AM
Kevin Eldurson
Kevin Eldurson - avatar
+ 4
well done @Texas.... @sid : long story short , instantiating a class == creating an object (an instance) of that class
22nd Feb 2018, 10:03 AM
Farshaad Heydari
Farshaad Heydari - avatar