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


Please Help Members By Posting Answers For Below Questions

What issues can be faced while delivering code?

1683


can you create a function in c# which can accept varying number of arguments

790


What is global asax in c#?

712


What is lazy keyword in c#?

669


What is a partial method?

687


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!!

1864


How to find whether the application is run from inside ide or not?

781


What is an escape sequence?

692


How do you create user defined data types in c#?

738


What is multicast delegate explain with example?

650


What are strongly typed objects?

675


What is AutoMapper in C#?

753


Difference between debug.write and trace.write?

724


how to prevent a class from being inherited in c#.net?

692


Why do we use inheritance in c#?

664