zoukankan      html  css  js  c++  java
  • iOS9新特性之泛型

    //
    //  ViewController.m
    //  02-iOS9新特性之泛型
    //
    //  Created by kun on 16/8/16.
    //  Copyright © 2016年 kun. All rights reserved.
    //
    
    /*
        泛型:限制类型
        为什么要推出泛型?迎合swift
        
        泛型作用:1,限制类型 2,提高代码规范,减少沟通成本
        泛型用法:类型<限制类型>
        泛型声明:在声明类的时候,在类的后面<泛型名称>
        泛型仅仅是报警告
        泛型好处:1,从数组中取出来可以使用点语法
                2,给数组添加元素有提示
        
        泛型在开发中使用场景:1,用于限制集合类型
        
        id是不能使用点语法
     
        为什么集合可以使用泛型?使用泛型,必须要声明泛型==>如何声明泛型
     
        自定义泛型
        什么时候使用泛型?在声明类的时候,不确定哪些属性或者方法类型,在使用这个类的时候才确定,就可以采用泛型
     
        如果没有定义泛型,默认就是id
     
     */
    
    #import "ViewController.h"
    
    @interface ViewController ()
    @property (nonatomic, strong) NSMutableArray<NSString *> *arr;
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
        
        
    }
    
    - (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    @end
  • 相关阅读:
    Cannot get a NUMERIC value from a STRING cell? 已解决
    Android Studio快捷键大全
    mysql索引
    eclipse中出现错误 Syntax error, insert "}" to complete Block
    function
    IGS OPC UA 配置
    IFIX 5.9 历史数据 曲线 (非SQL模式)
    IFIX 5.9 报警存sql
    IFIX 数据源 节点 标签 域名
    IFIX 目录结构
  • 原文地址:https://www.cnblogs.com/fkunlam/p/5775117.html
Copyright © 2011-2022 走看看