Object Oriented Programming

Instantiation in C#

Instantiation is used to create an object from a class (instantiate).


Syntax
objectName = new className(parameters);

Notes

Input requirements are taken from the constructor. A class can have multiple constructors with different numbers of input parameters and types, to create different objects.

An instance of a class is called an object.


Example
myCar = new Car ("Honda");

Add to Slack

< Constructor   |   Interfaces >

© 2019 SyntaxDB. All Rights Reserved.