Wednesday, June 17, 2020

Object in C# | An Object in Oops | What is Object in C sharp


Object in C# | An Object in Oops | What is Object in C sharp

Object is an entity of class which contains/Encapsulate all the functionality/futures of Class.
object encapsulate behavioural of the class. By the 'New' keyword we are requesting to CLR (Common Language Runtime) for creation of 
an object. 
Object in C# | An Object in Oops | What is Object in C sharp
An Object in c#


Many developer says that by the new keyword we are going to object (no).

See here:
Class ClsEmployee 
{

}

Object in C# | An Object in Oops | What is Object in C sharp
Object in C# | An Object in Oops | What is Object in C sharp
What is an Object


   Class  Ref Var/Object      Constructor
    |           |             |
    |           |             |
ClsEmployee Objemp=new ClsEmployee()
                    |
                    |
                  Request to 
                 Create an Object (At this stage multiple operation has been done by CLR-common Language Runtime).
In Class article as i told you class is reference type and that's why it store inside the Heap mamory,so when we are requesting to CLR for 
object creation/Instation it provides the memorey address for storing data in heap memory. In our above example common language runtime provide
memory address to 'Objemp' and by objemp data is store inside the those memory address.
 
An Object is basically a block of memory, which is alloacted according to class.

 

No comments:

Post a Comment

If you have any query kindly let me know.

Blazor drawback| drawback of blazor| Disadvantage of blazor in c#

  Blazor drawback| drawback of blazor| Disadvantage of blazor in c# While Blazor offers many advantages, it also has a few drawbacks to cons...