国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

objective-c - OC中遍歷陣列操作的結(jié)果為何是一串位址?
過(guò)去多啦不再A夢(mèng)
過(guò)去多啦不再A夢(mèng) 2017-05-02 09:29:55
0
1
540

頭檔

#import "LSTStockHolding.h"

@implementation LSTStockHolding
-(float)costInDollars
{
    float c = [self purchaseSharePrice];
    return c*[self numberOfShares];
}
-(float)valueInDollars
{
    return [self currentSharePrice]*[self numberOfShares];
    

main函數(shù)

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        LSTStockHolding *China = [[LSTStockHolding alloc]init];
        China.purchaseSharePrice = 4.0;
        China.currentSharePrice = 5.0;
        China.numberOfShares = 6.0;
        float cid =[China costInDollars];
        float vid =[China valueInDollars];
        NSLog(@"The cid is:%.2f,the vid is:%.2f.",cid,vid);
        NSArray *list = @[China];
        for(NSString *s in list)
        {
            NSLog(@"Here is a list:%@",s);
        }
    }
    return 0;

運(yùn)行結(jié)果如圖
2016-09-08 15:36:20.988 20章[863:97992] The cid is:24.00,the vid is:30.00.
2016-24.00,the vid is:30.00.
2016-09-08 15:396963:3966-09-6863:3966990963:39663:39663:396963:39669:39669:396963:396969:3969393993999399399393933位[3933999939分話(huà)[ :97992] Here is a list:

Program ended with exit code: 0

我想透過(guò)遍歷數(shù)組的操作,枚舉數(shù)組list的物件並且輸出LSTStockHolding物件的值,該如何操作呢?目前運(yùn)行結(jié)果是回傳了一個(gè)位址。 。初學(xué)者不太懂??
過(guò)去多啦不再A夢(mèng)
過(guò)去多啦不再A夢(mèng)

全部回覆(1)
劉奇

因?yàn)橛∷⒌氖侵羔?如果你想要打印更詳細(xì)的信息
你可以重寫(xiě)LSTStockHolding 類(lèi)的description方法,如下
教程

- (NSString *)description{
    
}
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板