[ ijurisic @ 18.08.2007. 17:11 ] @
Imam ovakav kod i očekivao sam da će proći ali mi puca kada se treba upisati string ime=u_ime, mada su obe varijable istog tipa string.

Citat:

class Cstudent
{
public:
Cstudent(string,string);
~Cstudent();
void Novi(Cstudent * );
void Ispis(Cstudent * );
double Prosijek_ocjena(Cstudent *);
bool Brisi(Cstudent * ,int );

int maticni_broj;
string Ime;
string Prezime;
double Prosjek;
Cstudent *next;

};


Cstudent::Cstudent(string u_ime,string u_prezime){

Ime = u_ime;
Prezime = u_prezime;

}

void main(){
Cstudent student("Pero","Matic");

}
[ Buffy @ 18.08.2007. 17:44 ] @
daj malo vise detalja.
koju poruku ispise prilikom debagovanja?
[ ijurisic @ 18.08.2007. 17:54 ] @
Riješeno !!!


Zamjenio sam:

Cstudent student("Pero","Matic");

Sa:

string s1="Pero";
string s2="Matic";
Cstudent student(s1,s2);
[ Buffy @ 18.08.2007. 20:16 ] @
pa char* takodje mozes proslijediti konstruktoru, ne bi trebalo da prijavi gresku.
[ kiklop74 @ 18.08.2007. 23:29 ] @
Citat:
ijurisic: Imam ovakav kod i očekivao sam da će proći ali mi puca kada se treba upisati string ime=u_ime, mada su obe varijable istog tipa string.


Promeni deklaraciju (i implementaciju) konstruktora da izgleda ovako:
Code:

Cstudent(const string&, const string&);


Sa takvom deklaracijom je moguce prosledjivati char* direktno.