## Definition To create an [[object]] from a [[class]]. *Verb. Noun form: instantiation.* > We instantiate a new `BankAccount` object every time a customer opens an account. ## Characteristics - Used in [[object-oriented programming]]; - creates a new object using its class as a template; and - calls the class [[constructor]] to set the object's initial [[object state|state]]. ## Examples ### Instantiating a `Person` object ```python class Person: def __init__(self, p_name, p_age): self.name = p_name self.age = p_age helen = Person("Helen", 45) # helen is instantiated as a Person object ``` ### Instantiating a `Person` object (Java) ```java Person f = new Person("Fife"); // instantiation ``` ## Non-examples ### Initialising a variable To [[initialise]] a variable does not instantiate an object[^1]. ```python x = 5 # no instantiation here ``` ### Declaring a variable (C) To [[declare]] a variable does not instantiate an object[^2]. ```C int x; // no instantiation here ``` ## Notes [^1]: Actually, it does. See [[Python quirks#Everything is an object]]. [^2]: This is true! There is no instantiation at all in C as it is not an object-oriented language.