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
What issues can be faced while delivering code?
can you create a function in c# which can accept varying number of arguments
What is global asax in c#?
What is lazy keyword in c#?
What is a partial method?
How to do and Apply Themes to Datagrid,Lable,Textbox,etc., in C#.NET 2005 Windows Application? (like who we will do themes in ASP.NET using .CSS and .SKIN files). Urgent!!
How to find whether the application is run from inside ide or not?
What is an escape sequence?
How do you create user defined data types in c#?
What is multicast delegate explain with example?
What are strongly typed objects?
What is AutoMapper in C#?
Difference between debug.write and trace.write?
how to prevent a class from being inherited in c#.net?
Why do we use inheritance in c#?