The difference, in non-technical English:
A Class has many uses in the object oriented environment of programming. One of its major advantages is that it can act as a blueprint for a new program you are about to write. For example, if your are building houses -- each house is different, one storey, two storey, three bedroom, five bedroom, etc, BUT there are some common elements in ALL houses -- the roof, floor, windows, door, etc. These common elements can go in a "House.class" file. So, when you are writing a "OneStoreyHouse.class" application for example, you can make an instance of the House.class in the OneStoreyHouse.class and be able to use all the pre-defined elements in that class to build your new class.
A Structure on the other hand deals with the data-type issue. if you are writing a job application program, you will need different types of data -- string (name), int (age), float (salary), char (m/f), etc. Normally, you would have to create an individual variable for each data type, so you would end pp with 4 variables. A structure can combine these 4 variables into 1 data-type, so you would only have to create 1 variable as this new data-type.
eg:
public struct ReqData
{
public string Name;
public int Age;
public char Gender;
public float Salary;
} appdata;
So, by defining appdata User, the single variable called User will now contain 4 different data-types.
Hopes this helps create a clear picture!
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).