Posts

Showing posts from April, 2020

C# class

Image
A class is used to model an object, it defines what the object is and how it is going to behave. A class is like a blueprint, from a single class we can create as many objects as we want at runtime, creating an object from a class is called instantiation. A class is a reference type meaning that when an object of the class is instantiated and the instantiated object is assigned to some variable, the variable which the instantiated object is assigned to holds only the memory location of the instantiated object. If the instantiated object is assigned to multiple variables, all the variable refers to the memory address of the instantiated object, changes made to one variable are reflected in the other variables. When you declare a variable of a class type without instantiation, the created variable holds a null value until you assign to it an object that is compatible with it. eg. SomeClass someclass; // someclass is a variable of type SomeClass and it has a value of null So...