+ 10
What is the different between a struct and a class in c#?
6 Antworten
+ 1
1. class has all the member private by default , but structure is a class where member are public by default .
2. classes allow to perform garbage collector before object is deallocated because g.c. work on heap memory !!
+ 7
@Nanda Balakrishnan well thanks..
+ 6
okk..thanks a lot..@deepanshu samdani
+ 4
A structure is a value type so it is stored on the stack, but a class is a reference type and is stored on the heap.
A structure doesn't support inheritance, and polymorphism, but aclass supports both.
By default, all the struct members are public but classmembers are by default private in nature.
http://www.careerride.com/C++-difference-between-struct-and-class.aspx
refer this link which will help u
+ 3
welcome
+ 3
Class has data members private by default,
with member functions or methods.
Struct data members are public by
default, also Struct have no methods.