Lecture overview -- Keyboard shortcut: 'u'  Previous page: Creating and Deleting Objects -- Keyboard shortcut: 'p'  Next page: Instantiation of classes in C# -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 24 : 29
Object-oriented Programming in C#
Classes and Objects
Instantiation of classes

We now focus on a particular way of object creation, namely instantiation of classes. There are - in principle - two approaches that can be used. Again, it should be emphasized that both approaches are not necessarily supported in a given programming language.

Instantiation is the process of allocating memory to a new object of some class

  • Static instantiation:

    • The object is automatically created (and destroyed) when the surrounding object or block is created.

  • Dynamic instantiation:

    • The object is created on demand, by calling a particular operator (new).

On the next page we will see that C# relies on dynamic instantiation.