1
Reply

What is difference between an Structure and Class?

Pankaj Pathak

Pankaj Pathak

11y
1.2k
0
Reply

    Class and Structure are syntactically same but there are few differences: 1. We can Not declare a constructor with no parameter (default constructor) for Structure, but can declare for Class. 2. In structure we can not initialize instance fields at their time of declaration, but in class we can do. Ex: sturct stuct1 {private int a = 0; // compile time error }class class1 {private int a = 0; // compile without error. }