Go to DotNetFunda.com
 Welcome, Guest!  
LoginLogin  
{ Submit content and get exposure !!! }
Submit: Article | Interview Question | Tips | Joke | Question | Link || Search  
 Skip Navigation Links Home > Interview/Exam Questions > Difference between classes and structures? ...


.NET Interview Questions

Difference between classes and structures?

Author: Majith | Posted on: 9/6/2008 10:10:38 AM | Category: C# | Views:509 |  Print Asked In: Many Interviews





Answer:
A struct is a value type and a class is a reference type.

When we instantiate a class, memory will be allocated on the heap and when struct gets initiated it gets memory on the stack.

Classes can have explicit parameter less constructors. But structs dosn't have this.

Classes support inheritance. No inheritance for structs.

A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.


Interesting?  Bookmark and Share


Navigate to:

<< Previous Interview Question: Difference between DropDownList.Items.Add and DropDownList.Items.Insert method

Next Interview Question >>: What is the purpose of connection pooling in ADO.NET?

Random Questions: Random Interview Questions

Help: If for some reason you are getting the same question by clicking Next and Previous, Try clicking Random Question or Category link above.


About Us | Contact Us | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
All rights reserved to DotNetFunda.com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)