captainc Messages: 278 Registered: December 2006 Location: New Jersey, USA
Experienced Member
Welcome israela. Feel free to post some screenshots in the "Applications created with U++" forum section. We are a very active community so feel free to post and ask for help. Make sure you understand all about pick semantics with Upp containers and data types. If you don't then you will be wondering why you passed it to a function and it didn't copy! If you feel like contributing, there are sections for that too .
Here's an example of pick semantics with Vector:
#include <Core/Core.h>
using namespace Upp
void Test(Vector<String> vs)
{
Cout() << "Vector Elements in Test() function: ";
for(int i=0;i<vs.GetCount();i++)
Cout() << " " << vs[i];
Cout() << "\n";
};
CONSOLE_APP_MAIN
{
Vector<String> vs;
vs << "a" << "b" << "c"; //Overloaded operator in container Vector to add elements.
Cout() << "Vector Elements: ";
for(int i=0;i<vs.GetCount();i++)
Cout() << " " << vs[i];
Cout() << "\n";
Test(vs); // This 'Picks' the vector out of this scope and now the function Test 'owns' it.
// THIS IS GOING TO FAIL
Cout() << "HERE COMES THE FAILURE: \n";
for(int i=0;i<vs.GetCount();i++)
Cout() << " " << vs[i];
Cout() << "\n";
}