I have a C++ programming test to do and I don't understand what thay wan't me to do

This is a discussion on I have a C++ programming test to do and I don't understand what thay wan't me to do within the C++ Programming forums, part of the General Programming Boards category; Her is the information, Is it somebody who have an ide, please give tips, i don't understand it.
Implement a ...

I have a C++ programming test to do and I don't understand what thay wan't me to do

Her is the information, Is it somebody who have an ide, please give tips, i don't understand it.

Implement a reference counting string class in C++ with at least support for
assignment and concatenation.
Write a test case which goes through all methods and alphabetically sort
some strings of this kind using a STL container.

Reference counted strings are such that share memory. Reference counter is also shared and is an integer that is incremented when memory is acquired and decremented when released.

In short:

Code:

shared_string aa = "This is shared string"; // memory is allocated for text, reference counter is set to 1
shared_string bb = aa; // bb points to the same memory location as aa, reference counter is incremented and is 2 now

When strign is destroyed (or changed) the reference counter is decremented and if it reaches 0, memory is freed.

I understand Reference counted strings and Reference counter and that they share memory.
But what should the reference counting string class in C++ with at least support for assignment and concatenation do!

How should the test case which goes through all methods connects with the reference counting string class?

Alphabetically sort some strings of this kind using a STL container in the test case, I think is another problem not connected to the reference counting string class, do you think that is correct?

Alphabetically sort some strings of this kind using a STL container in the test case, I think is another problem not connected to the reference counting string class, do you think that is correct?

No, it is clearly all meant to use the same class. Your class should simply implement the less-than operator, then I would suggest either throwing several into a vector and using std::sort, or just inserting them all into a std::set.

There is nothing that is not clear about what is required for this, to someone who knows what they're doing.

concatenation is like using += in a way it combines two strings...
so if you have 3 strings you could do something like
cc = aa;
cc += bb;

aa would have a count of 2 and bb would have a count of two. At least that is my understanding.

This would require additional information and string data would not be contiguous in memory.
+= operator should instantiate a new object with its own reference counter (or use an existing if the resulting string already exists in the container).
aa, bb, and cc would have a count of 1 (assuming aa and bb are not empty).

depends on the implementation of += as you can overload it, but yes with the current implementation, no that code won't do what he wants. Then again I thought it was a test like schoolwork test. I just wanted to give a vague answer that would give an idea of how I read the question.