Hi There,

I've got these 3 classes:
Code:
class APIDomain  
{
public:
	APIDomain();
	virtual ~APIDomain();
	CString domainName;
	std::vector<APIObject> objects;

};

class APIObject  
{
public:
	APIObject();
	virtual ~APIObject();
	CString objectName;
	std::vector<APIMethod> methods;
};

class APIMethod  
{
public:
	APIMethod();
	virtual ~APIMethod();

	CString methodDescription;
	CString methodName;

};
Most of my experience of programming is in Java, but I've got to make a bit of programming in VC++ and I've got a problem (lack of experience) with pointers, and C++ stuff.

I want to access a property/attribute of the APIObject class. So I did this:

Code:
//Created a vector of APIDomain Objects:
std::vector<APIDomain> domains;

//Fill a position of this vector:
APIDomain toAddAPIDomain; //Temp. APIDomain object
toAddAPIDomain.domainName = valueX;
domains.push_back(toAddAPIDomain);

//Now add a APIObject to the parameter objects(vector of APIObject) of the APIDomain object.

//I'm having some problems with this one...

//1st try:

std::vector<APIObject> tmpVectorAPIObject;
tmpVectorAPIObject = domains[domainIndex].objects;
tmpVectorAPIObject.push_back(tmpObject);

With the above code, I'm not inserting into the domains object, but in the temporary variable !?!??! (In Java the above code would create a pointer to the position of the attribute, any changes made to the temp. vars would be reflected in the domains object)

The code below works, but I prefer to create a temporary var so that the code becomes more simple to read (If I try to get an attribute of the APIMethod this line becames too large)

Code:
domains[domainIndex].objects.push_back(tmpObject);


How can I solve this problem?

I want to create a temporary variable and work with it, so that any changes made to the temp. variable are made directly to the original object.

I know that I must use a pointer to solve this, but what should I do?

Modify the classes that I've created (instead of vector use a vector *)?

Or there is a way of creating a temporary variable that points to the vector attribute of the class?

Thank You

Pinho