K
Krzysztof
Hi!
I have a class:
some_class{
private:
char* seq;
public:
some_class(char* se);
char* ret_seq();
....
}
some_class::some_class(char* se){
seq=new char[strlen(se)];
seq=se;
}
char* some_class:ret_seq(){
static char* sequ;
sequ=se;
return sequ;
}
and than
I have the function witch should modify the array of the objectc of
the some_class:
int func(some_class** obj){
....
char* tmp;
for(int i=0;i<foo;i++){
.....
obj=new some_class(tmp);
cout<<(*obj).ret_seq()<<endl; //LINE A
}
return foo;
}
and when I want to get the seq values for all objects in the array:
main()
{
some_class** objs=new some_class*[100];
int i;
i=func(objs);
for(int j=0;j<i;j++)
{
cout<<(*objs).ret_seq()<<endl; //LINE B
}
....
and the problem is that the results that I obtain from LINE A and LINE
B are not the same.
If you have any idea why please help. I would be very thankful
Greetings
PS: I have just started to programm in C++
I have a class:
some_class{
private:
char* seq;
public:
some_class(char* se);
char* ret_seq();
....
}
some_class::some_class(char* se){
seq=new char[strlen(se)];
seq=se;
}
char* some_class:ret_seq(){
static char* sequ;
sequ=se;
return sequ;
}
and than
I have the function witch should modify the array of the objectc of
the some_class:
int func(some_class** obj){
....
char* tmp;
for(int i=0;i<foo;i++){
.....
obj=new some_class(tmp);
cout<<(*obj).ret_seq()<<endl; //LINE A
}
return foo;
}
and when I want to get the seq values for all objects in the array:
main()
{
some_class** objs=new some_class*[100];
int i;
i=func(objs);
for(int j=0;j<i;j++)
{
cout<<(*objs).ret_seq()<<endl; //LINE B
}
....
and the problem is that the results that I obtain from LINE A and LINE
B are not the same.
If you have any idea why please help. I would be very thankful
Greetings
PS: I have just started to programm in C++