Click here to Skip to main content
15,917,928 members
Home / Discussions / C#
   

C#

 
GeneralRe: struct and class Pin
OriginalGriff26-Apr-10 21:47
mveOriginalGriff26-Apr-10 21:47 
GeneralRe: struct and class Pin
Gideon Engelberth27-Apr-10 2:53
Gideon Engelberth27-Apr-10 2:53 
GeneralRe: struct and class Pin
OriginalGriff27-Apr-10 3:20
mveOriginalGriff27-Apr-10 3:20 
GeneralRe: struct and class Pin
harold aptroot27-Apr-10 3:40
harold aptroot27-Apr-10 3:40 
GeneralRe: struct and class Pin
DaveyM6927-Apr-10 4:42
professionalDaveyM6927-Apr-10 4:42 
GeneralRe: struct and class Pin
OriginalGriff27-Apr-10 5:30
mveOriginalGriff27-Apr-10 5:30 
GeneralRe: struct and class Pin
Gideon Engelberth27-Apr-10 13:09
Gideon Engelberth27-Apr-10 13:09 
AnswerRe: struct and class Pin
OriginalGriff26-Apr-10 21:41
mveOriginalGriff26-Apr-10 21:41 
Ignore what Calla says - a struct can indeed have methods, properties and events. In fact, there are only three real differences between a struct and a class:

1) A struct is created on the stack, not the heap.
2) A struct cannot have a parameterless constructor - it must have at least one parameter.
3) A struct is always sealed - you cannot inherit from it.

The first difference is the biggie: it means that you deal with the instance directly, not via a reference. Why this is important is a bit complex, so it would be best for you to read a good book on C# as it is very important that you understand what happens properly, if you are going to use structs instead of classes. At least the authors will have experience in explaining the difference to beginners, and teh added benefit of pictures, which make things a lot easier to understand!
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace

C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

GeneralRe: struct and class Pin
Calla26-Apr-10 21:49
Calla26-Apr-10 21:49 
GeneralRe: struct and class Pin
OriginalGriff26-Apr-10 22:03
mveOriginalGriff26-Apr-10 22:03 
GeneralRe: struct and class Pin
Calla27-Apr-10 0:28
Calla27-Apr-10 0:28 
GeneralRe: struct and class Pin
PIEBALDconsult27-Apr-10 3:20
mvePIEBALDconsult27-Apr-10 3:20 
AnswerRe: struct and class Pin
DaveyM6927-Apr-10 0:01
professionalDaveyM6927-Apr-10 0:01 
AnswerRe: struct and class Pin
PIEBALDconsult27-Apr-10 3:23
mvePIEBALDconsult27-Apr-10 3:23 
QuestionChange controls size at runtime Pin
jojoba201126-Apr-10 21:01
jojoba201126-Apr-10 21:01 
AnswerRe: Change controls size at runtime Pin
Ankur\m/26-Apr-10 21:08
professionalAnkur\m/26-Apr-10 21:08 
QuestionRe: Change controls size at runtime Pin
jojoba201126-Apr-10 21:11
jojoba201126-Apr-10 21:11 
AnswerRe: Change controls size at runtime Pin
Ankur\m/26-Apr-10 21:16
professionalAnkur\m/26-Apr-10 21:16 
QuestionRe: Change controls size at runtime Pin
jojoba201126-Apr-10 21:30
jojoba201126-Apr-10 21:30 
AnswerRe: Change controls size at runtime Pin
Bernhard Hiller26-Apr-10 21:56
Bernhard Hiller26-Apr-10 21:56 
QuestionRe: Change controls size at runtime Pin
jojoba201126-Apr-10 22:05
jojoba201126-Apr-10 22:05 
AnswerRe: Change controls size at runtime Pin
Rajesh Anuhya26-Apr-10 22:11
professionalRajesh Anuhya26-Apr-10 22:11 
QuestionRe: Change controls size at runtime Pin
jojoba201126-Apr-10 22:16
jojoba201126-Apr-10 22:16 
AnswerRe: Change controls size at runtime Pin
Rajesh Anuhya26-Apr-10 22:38
professionalRajesh Anuhya26-Apr-10 22:38 
QuestionRe: Change controls size at runtime Pin
jojoba201126-Apr-10 22:43
jojoba201126-Apr-10 22:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.