B
Bhuwan Bhaskar
Hi,
When to use class and when structure in our application?
Thanks,
Bhuwan
When to use class and when structure in our application?
Thanks,
Bhuwan
Bhuwan said:Hi,
When to use class and when structure in our application?
Bhuwan said:When to use class and when structure in our application?
Kevin said:Another consideration is that a class is a reference type while a structure
is a value type. So, if you want to create copies of instances instead of
references when assigning, structures provide a simple way to ensure that
this is done. That is, if you want assignments to default to copies or
values rather than references, use a structure. This is one way to prevent
accidental modification of the data in the original entity.
Andrew Faust said:In addition to what the other responders said. The most common place I use
struct is if I have a function that needs to return more than 1 value. For
example, suppose you had a function that did integer division. You may
want to return a struct that contained both the quotiant and remainder.
--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com
Bhuwan Bhaskar said:Hi,
When to use class and when structure in our application?
Thanks,
Bhuwan
Kindly explain how a function can return more than one value?