This blog defines the difference between Class and Structure.
Class
- Class is a reference type and its object is created on the heap memory.
- Class can inherit the another class.
- Class can have the all types of constructor and destructor.
- The member variable of class can be initialized directly.
- class object can not be created without using the new keyword, it means we have to use it.
Demo obj=new Demo();
Structure
- Structure is a value type that is why its object is created on the stack memory.
- Structure does not support the inheritance.
- Structure can only have the parametrized constructor. it means a structure can not have the non-parametrized constructor,default constructor and destructor also.
- The member variable of structure can not be initialized directly.
- Structure object can be created without using the new keyword.(optional)
Demo obj;


Prasanna MiskinPosted Jul 7, 2017, 1:45 AM EDT
I have a doubt here, int x = new int(); is possible that means since int is struct therefore 3rd point for structures is not completely correct.
ashok rathodPosted Apr 26, 2016, 7:13 PM EDT
this is really good
Raman JoshiPosted Aug 2, 2015, 6:09 PM EDT
why don't u ll read books.
Nidhin T BPosted May 26, 2015, 11:03 PM EDT
class object can not be created without using the new keyword???? then how about : Class obj = null; or assigning another obj to this.
prashant manePosted Jan 22, 2015, 5:27 PM EST
it is not brief but very good
dell mercaPosted Jan 18, 2015, 8:18 PM EST
More about difference between class and structure http://net-informations.com/faq/oops/struct.htm
Chandan pathakPosted Dec 27, 2014, 6:46 AM EST
Not bad Really Good !!
Mohammad NadeemPosted Sep 15, 2014, 1:50 AM EDT
Please Explain With a suitable example
Co. AdenPosted Jul 24, 2014, 5:15 PM EDT
Sorry but i found some mistakes in ur post:
Balaji SelvarajanPosted Apr 6, 2014, 9:35 PM EDT
Valuable
Dhanik SahniPosted Jul 29, 2013, 5:24 AM EDT
Good one