what are the differences b/w structure and class?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a hash table in c#?

717


How to parse a date time string?

743


How do you remove white spaces from a string?

713


How do you specify a custom attribute for the entire assembly?

668


When should you use generics?

698


How to sign an assembly with strong name?

766


When Should You Call The Garbage Collector In .net?

780


What is the .net datatype that allows the retrieval of data by a unique key?

678


what is the difference between interface and multiple interface?

751


What is void in c#?

741


How much time will it take to learn unity?

685


Define satellite Assembly?

754


What is an extension method in c#?

724


who is a protected class-level variable available to?

744


What is the difference between C# 3.5 and C# 4.0?

732