8. struct

IOS/Swift 문법 2016. 5. 20. 15:46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//: Playground - noun: a place where people can play
 
import UIKit
 
var name = ["Park" ,"Choi","Kim""Lee"]
var age = [3,4,5,6]
var height  = [40,50,60,70]
 
print(name[0], age[0],height[0])
 
struct Student {
    var name:String
    var age:Int
    var height:Int
    
}
 
var student1 = Student(name: "Park", age: 3, height: 40)
var student2 = Student(name: "Choi", age: 4, height: 50)
 
struct Student2 : Student {
    
}
cs

struct cann't apply inheritance 


struct Student2 : Student {
    
}


'IOS > Swift 문법' 카테고리의 다른 글

10 문법을 마무리하며..  (0) 2016.05.20
9. Optional Value  (0) 2016.05.20
7. class  (0) 2016.05.20
6. Functions  (0) 2016.05.20
5. Conditional Statements  (0) 2016.05.20
Posted by Hoya0415
,