Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


why sturcture ? why class?why you prefer structure and in
which cases u go for class?



why sturcture ? why class?why you prefer structure and in which cases u go for class?..

Answer / 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

More C Sharp Interview Questions

What is delegates and events?

0 Answers  


What is the difference between readkey and readline in c#?

0 Answers  


Can we have two main methods in c#?

0 Answers  


What is indexers in C#

4 Answers   Bodhtree,


How can you clean up objects holding resources from within the code?

2 Answers   L&T, Wipro,


What is Co- and Contra-Variance in C#?

0 Answers  


Is there a way to force garbage collection?

0 Answers  


Can you override private virtual methods?

11 Answers   AROBS Transilvania Software, IBM, Mind Tree, Revalsys,


What is a service layer c#?

0 Answers  


What is the use of base keyword? Tell me a practical example for base keyword’s usage?

0 Answers  


How long will it take to learn c#?

0 Answers  


What do you understand by the terms datareader object and dataset object?

0 Answers  


Categories