Understanduing the difference between C++ and C# therefore know the computer language deeper.
vector<string*> svec;
string line;
while(getline(cin,line))
{
//1)Instead, the new expression returns a pointer to the newly allocated objects.
string *sp= new string(line);
svec.push_back(sp);
}
// 2) understanding the iterator which use the composition not the inhertiance to solve the traverse problem to any container.
vector<string*>::iterator ster = svec.begin();
while (ster != svec.end())
{
cout <<**ster<<" "<<(**ster).size() << endl;
ster++;
}
//3) delete the allocated storage in heap
ster = svec.begin();
while (ster != svec.end())
{
delete *ster;
ster++;
}
return 0;
//Following is the result.