+ 6
What do you mean by instantiation an object? Representing??????!
please help me with vocabulary
2 Respuestas
+ 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.
+ 4
well done @Texas....
@sid : long story short , instantiating a class == creating an object (an instance) of that class