What is a class instance in C#?
Experience Level: Junior
Tags: C#
Answer
In C#, a class instance is an object that was created based on the class.
The class is like a recipe that defines a logic how to cook a meal. The meal prepared by a recipe is then called a class instance. Or an object.
In the following program there is a class Dog
defined. Based on this class 3 dog objects are created. We are saying that we have created 3 instances of class Dog
.
Related C# job interview questions
How can you recognize a property in C#?
C# JuniorWhat is a property in C#?
C# JuniorWhat is a difference between value type and reference type?
C# JuniorWhat is an object reference in C#?
C# JuniorWhat C# data types do you know?
C# Junior