Click here to Skip to main content
15,905,912 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
what is diffrence between structure and class in c# plz give answser with some valid expamples.quick plz
Posted
Comments
CPallini 25-Jan-13 13:34pm    
"quick plz"
:-D
There would be nothing more quick than yourself doing a quick Google search!

 
Share this answer
 
The term "difference" is not logically accurate, inapplicable to most cases.

So, something practically most important:

Struct is a value type, class is a reference type.

And one false difference which many people mistakenly think off. Many don't know that struct can also implement interfaces. They can, exactly as classes. But this is very non-trivial, because if a struct object is accessed via a variable/member of interface type, it works like a reference. Besides, this introduces a more advanced kind of polymorphism: the polymorphous set is abstracted not only from the runtime types, but even from the nature (value or reference) of these type. Besides, the same struct/class can implement more then one interface and participate in more then one unrelated polymorphous sets.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900