Sign in to follow this  

Confused about the object, element, container tree.

This topic is 4169 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So as confusing as my title is, I think I'm about to make it ten times worse. Basically what I am having trouble with is the "tree diagram" of elements, objects, arrays containers etc. (I'm calling it a tree, if there is official term for it please let me know. So let me try and clear this up real quick. I sort of understand that an object is,... a object that can store data, and be accessed by member functions. after that my terminology understanding flys out the window. It says that string objects can be stord in arrays, and that arrays have access to elements, and then containers also have access to elements, so what I'm asking is what do these terms mean, and are they basically Little objects inside of bigger objects??? Any help would be much appreciated, because i think i have completely confused myself.

Share this post


Link to post
Share on other sites
Element is generally taken in this context to mean one of the items in a container, be that container an array, a vector or whatever, as in "The array has four elements".

Object is generally taken to mean a collection of data along with a set of functions that act upon the data. In a language like C++ this can be expressed directly through classes but it is just as valid really to call a C struct and a bunch of functions that act on the struct an object in the literal sense.

An array is a simple form of container really. Container is a general term for some kind of data structure that contains a number of other structures or objects. An array is a specific sort of container (normally a continuous bit of memory where the items sit one after the other). The difference between an array and something like std::vector which also stores objects continuously in memory is that an array is taken to be just a plain structure with no additional functionality built in, whereas a std::vector also provides functions to operate upon itself and its data, and is in this sense also an object.

Hope that helps. Didn't come out nearly as clearly as I thought it would.

Share this post


Link to post
Share on other sites

This topic is 4169 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this