why sturcture ? why class?why you prefer structure and in
which cases u go for class?
Answer Posted / supraja
Class
-->It is reference type
-->The values allocated in heap
-->Can have constructors, properties, methods
-->Abstract and sealed are possible
-->We cannot have parameter less constructor
-->We can overload constructors
-->Reference type
-->Supports data members, code members (methods) and events
-->Supports inheritance
-->Preferable when you need to initialize one or more
members upon creation
-->Can have parameterized constructors
-->More flexible, unlimited event handling support
Structure
-->It is value type
-->The values allocated in stack
-->Can have constructors, properties, methods
-->Abstract and sealed are not possible
-->By default public
-->We cannot have parameter less constructor
-->We can overload constructors
-->Value type
-->Supports data members, code members (methods) and events
-->Can not inherit
-->Preferable when you perform large number of operations
on each instance
-->Can not control initialization using structure variable
-->Less flexible, limited event handling support
| Is This Answer Correct ? | 4 Yes | 6 No |
Post New Answer View All Answers
Can non-default constructors be used with single call sao?
What is inumerable?
What is difference between write and writeline in c#?
What are the types of methods in c#?
Write a C# program to find the Factorial of n
Explain the difference between and xml documentation tag?
How do you access a constant field declared in a class?
Explain synchronous and asynchronous operations?
What does exclamation mark mean c#?
What is asp net c# corner?
What is difference between an reference type and value type in C#?
What are abstract classes in c#?
What are the different types of literals in c#?
Why do we use reflection in c#?
Which constructor is called first in c#?