VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1 ]
Subject: Re: Upphafsstilling á fylki sem er í klasa


Author:
Hjálmtýr
[ Next Thread | Previous Thread | Next Message | Previous Message ]
Date Posted: 08:53:38 04/15/04 Thu
In reply to: ggp 's message, "Upphafsstilling á fylki sem er í klasa" on 02:17:30 04/15/04 Thu

>Hvernig upphafsstilli ég fylki sem er í klasa með
>smiðnum?
>
>Í c++ virðist vera sérstök aðferð til að upphafsstilla
>t.d. int p með smið einhvers klasa KLASI:
>KLASI::KLASI():
>p(78)
>{
> cout< >}
>
>Hér hefur p verið sett 78, ef í staðin væri int p=78;
>inni í slaufunum, myndi main fallið ekki kannast við
>að p=78.
>En hvernig gerir maður hliðstætt fyrir vektor eða
>fylki og afhverju er þetta ekki bara haft þannig að
>það dugi allt sem skrifað er inn í slaufunni?

Ég held að það sé ekki hægt að upphafsstilla vektora í smiðum á þennan hátt (nema þá að telja upp öll stökin
í þeim). Þú verður bara að skrifa for-lykkju inní smiðnum sjálfum. Það er mjög lítill munur á því að upphafsstilla
breytur með upphafsstillingarlista (initialization list) og að gera það í kóda í smiðnum.

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]


Forum timezone: GMT+0
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.