What are the differences between class and Structure?
By in C, C++, MFC on Nov 06 2007
  • Neha Kumari
    Nov, 2017 5

    By default members of class are private But members of structure are public.

    • 1
  • Mukesh Kumar
    Sep, 2017 2

    Class object occupy space in heap While structure object in stack Class is reference type While structure is value type

    • 1
  • Vishal Gupta
    Mar, 2008 30

    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

    • 1
  • Jan, 2008 31

    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.

    • 1
  • Jan, 2008 31

    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.

    • 1
  • Jan, 2008 31

    Hi Rathore,

             Class and Sturcture is almost different.

    • 1
  • Mark
    Nov, 2007 20

    So class is of reference type while structure is of value type

    www.QuiznetOnline.com

    • 1
  • Nov, 2007 6

    What are the differences between class and Structure?

    • 1


Most Popular Job Functions


MOST LIKED QUESTIONS