Friday 27 December 2019

class vs structure


class
1- Class is a reference types.
2- Class uses new keyword for instance.
3- reference type is stored in heap memory.
4- Class can have constructor or destructor.

Struct
1- it is value type
2- it is not using new keyword
3- value type stored in stack memory
4- it do not have constructor or destructor

No comments:

Post a Comment