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


what are the differences b/w structure and class?

Answers were Sorted based on User's Feedback



what are the differences b/w structure and class? ..

Answer / purushotham .tella

Structures are Value-Types. This means, the data that they
contain is stored as a stack on the memory. Classes are
Reference-Types, means they are stored as a heap on the memory.

Structures are implicitly derived from a class called
System.ValueType.

Is This Answer Correct ?    14 Yes 0 No

what are the differences b/w structure and class? ..

Answer / kiran

Following are the key differences between them :-
1. Structure are value types and classes are reference
types.So structures use
stack and classes use heap.
2. Structures members can not be declared as protected ,
but class members can
be.You can not do inheritance in structures.
3. Structures do not require constructors while classes
require.
4. Objects created from classes are terminated using
Garbage collector.Structures are not destroyed using GC.

Is This Answer Correct ?    14 Yes 0 No

what are the differences b/w structure and class? ..

Answer / dhinakaran

Class is a reference Type.
structure is a value Type.

Is This Answer Correct ?    4 Yes 0 No

what are the differences b/w structure and class? ..

Answer / jones

***class can have constructor, but structure cant have
constructor.***

***class can have garbage collector, but structure cant
have garbage collector***

Is This Answer Correct ?    5 Yes 2 No

what are the differences b/w structure and class? ..

Answer / sai laxman

class ex:-
class classname
{
int a;
float b;
}
struct {
int a;
int b;
}struct name;

In the struct all members are by default public,
in the class we can deference it private,public,protected.
While Inheriting from the structure all the members are
public by default but in class it depends upon the data
access modifiers.

Is This Answer Correct ?    7 Yes 6 No

what are the differences b/w structure and class? ..

Answer / abhay k pandey

Structs many have constructors but they should not be
parameterless. Structs performs alomost all the tasks of a
class but differs at some points - structs don't support
inheritance hence there is no protected keyword with
structs. Note : still struct inherit from System.Object

Is This Answer Correct ?    1 Yes 0 No

what are the differences b/w structure and class? ..

Answer / ctharam

Struct:-
-------
1) by default, Public
2) doesn't support OOP's Concepts.
3) doesn't support Constructor and Destructor member functions.
4) No Security for data.

Class:-
-------
1) by default ,Private
2) its support OOP's Concepts.
3) supports Constructor and Destructor .
4) provides highly security for user's data.

Is This Answer Correct ?    1 Yes 0 No

what are the differences b/w structure and class? ..

Answer / sagu

In classes we can code functions which is not possible in
structures. In structures the number of members is
restricted to ten.whereas in c language we can use as many
members we required.

Is This Answer Correct ?    1 Yes 1 No

what are the differences b/w structure and class? ..

Answer / srikanth chodavarapu

Following are the key differences between them :-
1. Structure are value types and classes are reference
types.So structures use
stack and classes use heap.
2. class can have constructor, but structure cant have
constructor.
3. class can have garbage collector, but structure cant
have garbage collector.

Is This Answer Correct ?    1 Yes 2 No

what are the differences b/w structure and class? ..

Answer / rajesh

the only main difference b/w structure and class is by
default all members of structure are "public" where as for
the class they are "private",other wise structure is same
as class.All these answers have no sense

Is This Answer Correct ?    3 Yes 8 No

Post New Answer

More C Sharp Interview Questions

What is multithreading? What are the problems that comes with multithreading and how to manage them?

0 Answers   MCN Solutions,


what is generics? can u explain 5 to 6 examples on generics that covers class,method,structure,list,delegates?

0 Answers   CTS,


How do you comment out code in c#?

0 Answers  


How do I create a delegate/multicastdelegate?

0 Answers  


I have a class declared as below public class a { public void add() {} } What is the diference between a a1 =new a; and simply a a1;

3 Answers  


In .NET which is the smallest unit of execution?

0 Answers   Siebel,


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

0 Answers  


Can I fly with a loop recorder?

0 Answers  


What debugging tools come with the .NET ssSDK?

0 Answers   Siebel,


Write a program to create a user control with name and surname as data members and login as method and also the code to call it. (Hint use event delegates) Practical Example of Passing an Events to delegates

0 Answers  


If a.equals(b) is true then a.gethashcode & b.gethashcode must always return same hash code.

0 Answers  


What is the difference between Java and .NET garbage collectors?

0 Answers   BirlaSoft,


Categories