I have a problem with ruby containers.what is the differnce
between containers and classes.Is there any syntax for containers.can
you please
reply me.
AFAIK 'container' is just a general word for the classes that let you
contain objects: Hash and Array are the most commonly used example, but
you have others such as Queue. You could also view String as a
container class as it 'contains' characters.
There's no 'Container' class, so there's no syntax for containers,
although the classes that are referred to as containers (Hash, Array,
String etc) may define some common methods such as size (aka length).
This isn't required though.
I have a problem with ruby containers.what is the differnce
between containers and classes.Is there any syntax for containers.can
you please
reply me.
AFAIK 'container' is just a general word for the classes that let you contain objects: Hash and Array are the most commonly used example, but you have others such as Queue. You could also view String as a container class as it 'contains' characters.
I'd add: it's typical for a container class to contain arbitrary many instances of other classes.
There's no 'Container' class, so there's no syntax for containers, although the classes that are referred to as containers (Hash, Array, String etc) may define some common methods such as size (aka length). This isn't required though.
Adding to that there *is* special syntax in Ruby, namely