Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Samo komentar o generičkim kontejnerima

[es] :: .NET :: Samo komentar o generičkim kontejnerima

[ Pregleda: 1614 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

dontoo

Član broj: 249815
Poruke: 40
*.adsl.net.t-com.hr.



+1 Profil

icon Samo komentar o generičkim kontejnerima03.04.2010. u 10:06 - pre 171 meseci
Recimo imam:
StructMy a = new StructMy(); //public int x, int y članovi
List<StructMy> b = new List<StructMy>();
a.x = 3;
a.y = 4;
b.Add( a );
b[0].x = 5 //Nemože, b[0].x nije varijabla, moram napravit novi objekt struckture i zamijenit ga sa starim

Totalna glupost.
 
Odgovor na temu

lonelyrider_44
Zrenjanin

Član broj: 42310
Poruke: 445
*.com
Via: [es] mailing liste



+20 Profil

icon Re: Samo komentar o generičkim kontejnerima03.04.2010. u 10:51 - pre 171 meseci
Bash i nije glupost, ako se uzme u obzir smisao strukture(struct). Koristi
klasu umesto strukture i radice.


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
 
Odgovor na temu

Igor Gajic

Član broj: 93194
Poruke: 747
89.216.88.*



+987 Profil

icon Re: Samo komentar o generičkim kontejnerima03.04.2010. u 10:53 - pre 171 meseci
Citat:

The operator [] is actually a function call. When you index a list and get the individual element, you are actually making a function call. You get the individual element as the return value of the function. This return value is placed on the stack and when you try to use the dot operator on this, you are actually trying to modify the return value of the function. i.e. you are modifying a copy of the element and your modifications will not affect the element in the list. The compiler, smart it is, catches this and informs you of the pitfall.


Mislim da ovo daje odgovor na "glupost". Manje vise svi pre ili kasnije nalete na taj problem...

http://generally.wordpress.com/2007/06/21/c-list-of-struct/
 
Odgovor na temu

dontoo

Član broj: 249815
Poruke: 40
*.adsl.net.t-com.hr.



+1 Profil

icon Re: Samo komentar o generičkim kontejnerima03.04.2010. u 12:40 - pre 171 meseci
kad sam u C-u navikao koristiti strukture pa ih koristim i u objektnim jezicima
 
Odgovor na temu

deerbeer
Beograd

Član broj: 174418
Poruke: 1189
*.mbb.telenor.rs.



+395 Profil

icon Re: Samo komentar o generičkim kontejnerima03.04.2010. u 13:29 - pre 171 meseci
Pa navikni se , nece boleti glava od klasa :)

Viva lollapalooza
 
Odgovor na temu

[es] :: .NET :: Samo komentar o generičkim kontejnerima

[ Pregleda: 1614 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.