Software Engineer · Author has 469 answers and 343.5K answer views · Updated 4y ·
It is the creation of a new instance of an object, with respect to OOP.
Suppose we have a programming class called “Dog”. To instantiate this class we create a new object of type Dog. We would do something like this:
- // this is instantiation
- Dog myDog = new Dog();
- // set properties of the dog
- myDog.setName(“Fido”);
- myDog.setAge(3);
- myDog.setBreed(“Airedale”);
- // other instantiation methods, if the constructor is overloaded
- Dog bigDog = new Dog(“Rover”, 4, “Great Dane”);
14.8K views ·
View upvotes
· 1 of 4 answers
Something went wrong. Wait a moment and try again.