P
pruebauno
I have a header for a c++ class I am using (from IBM WebSphere
DataStage):
....
// ---------------------------
// --- assignment operator ---
// ---------------------------
/**
If isFixedLength() is true, copies min(length(),
rhs.length()) characters from rhs into this string.
If less than length() characters are copied, the
balance of the length() is right-filled with pad
characters.
If isBoundedLength() is true, silently clamps the copied
length according to the bound.
Only the string value is copied; attributes such as
fixed-length, pad char, etc. are not copied.
@note For variable-length strings, it is not necessary to call
setLength() before calling this function.
*/
APT_BasicString& operator= (const APT_BasicString& rhs);
/**
* See APT_BasicString& operator= (const APT_BasicString& rhs).
*/
APT_BasicString& operator= (const C* rhs);
/**
* See APT_BasicString& operator= (const APT_BasicString& rhs).
*/
APT_BasicString& operator= (C c);
....etc.
And I have a program that does the following:
APT_String depen[15],frst[15];
int i;
....
//some code that assigns data to depen[0..14]
for(i=0;i<14;i++){
frst=depen;
}
Question: Am I copying the values or pointers of the strings in depen?
I am asking because after that code I change the values of depen[0..14]
and later in the code frst does not have the content I am expecting
(The original unchanged, that is). Of course it also could be that my
logic is messed up somewhere else but I just wanted to make sure I am
understanding this aspect of c++ correctly.
DataStage):
....
// ---------------------------
// --- assignment operator ---
// ---------------------------
/**
If isFixedLength() is true, copies min(length(),
rhs.length()) characters from rhs into this string.
If less than length() characters are copied, the
balance of the length() is right-filled with pad
characters.
If isBoundedLength() is true, silently clamps the copied
length according to the bound.
Only the string value is copied; attributes such as
fixed-length, pad char, etc. are not copied.
@note For variable-length strings, it is not necessary to call
setLength() before calling this function.
*/
APT_BasicString& operator= (const APT_BasicString& rhs);
/**
* See APT_BasicString& operator= (const APT_BasicString& rhs).
*/
APT_BasicString& operator= (const C* rhs);
/**
* See APT_BasicString& operator= (const APT_BasicString& rhs).
*/
APT_BasicString& operator= (C c);
....etc.
And I have a program that does the following:
APT_String depen[15],frst[15];
int i;
....
//some code that assigns data to depen[0..14]
for(i=0;i<14;i++){
frst=depen;
}
Question: Am I copying the values or pointers of the strings in depen?
I am asking because after that code I change the values of depen[0..14]
and later in the code frst does not have the content I am expecting
(The original unchanged, that is). Of course it also could be that my
logic is messed up somewhere else but I just wanted to make sure I am
understanding this aspect of c++ correctly.