By default members of class are private But members of structure are public.
Class object occupy space in heap While structure object in stack Class is reference type While structure is value type
class and structure are very similar. the former is heavyweight while the latter is light weight. reference to the former rests on the heap..while the latter in whole (instance and data) rests on the stack. therefor care should be taken not to make a struct very heavy else it overloads the stack causing mem hogging. class needs to have an instance explicitly created to be used. A struct does n't have to be explicitly initiated
Class and structure is almost same. Default access mode in class is private and in structure it is public. In struct it is necessary to given name struct when u create an object somewhere else in the program whereas u dont wana specify it for a class. U can use the class name and create an object.
Hi Rathore,
Class and Sturcture is almost different.
So class is of reference type while structure is of value type
www.QuiznetOnline.com
What are the differences between class and Structure?