IOS/Swift 문법

8. struct

Hoya0415 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 {
    
}