The Partridge Family were neither partridges nor a family. Discuss.
-
Clodi
- Posts: 175
- Joined: November 18th, 2012, 7:47 pm
Post
by Clodi » October 13th, 2014, 9:01 pm
Hello,
I have
I can then have a set function:
what about a get function that returns all three integer's?
-
cameron
- Posts: 794
- Joined: June 26th, 2012, 5:38 pm
- Location: USA
Post
by cameron » October 13th, 2014, 9:15 pm
Return a struct/class object.
Computer too slow? Consider running a VM on your toaster.
-
Clodi
- Posts: 175
- Joined: November 18th, 2012, 7:47 pm
Post
by Clodi » October 13th, 2014, 9:18 pm
thanks mate!
for that simple example you would obviously use a struct right? (not a class)
-
cameron
- Posts: 794
- Joined: June 26th, 2012, 5:38 pm
- Location: USA
Post
by cameron » October 13th, 2014, 9:27 pm
Depends, but I would probably do struct.
Computer too slow? Consider running a VM on your toaster.
-
Clodi
- Posts: 175
- Joined: November 18th, 2012, 7:47 pm
Post
by Clodi » October 13th, 2014, 9:35 pm
cheers mate
-
Xydrel
- Posts: 2
- Joined: October 14th, 2014, 2:34 am
Post
by Xydrel » October 14th, 2014, 2:38 am
Another option, if your compiler has support for C++11, you can set and return a Tuple. That's a multi value object.
-
albinopapa
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Post
by albinopapa » October 14th, 2014, 7:24 pm
Why would anyone use tuple's over structs?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com