ios개발/개념 정리
<스위프트> class vs struct
studying develop
2020. 3. 5. 10:25
<https://www.youtube.com/watch?v=TpCCveP0E_M>
1. struct gives me a free init and i need to define one for class
2. inheritance (classes support inheritance, while structs don't)
3. classes are reference types and struct are value types
이렇게 클래스에 의해 생성한 한 객체를 다른 객체에 할당하면 레퍼런스로 넘어간다.
[https://devmjun.github.io/archive/Swift-StructVSClass]
음 이걸 보면 역시 지역변수는 스택에 저장되고
새로 생성되는 클래스의 인스턴스는 힙에 생긴다.
스위프트는 스태틱 메소드 , 클래스 메소드 두개가 동일한거 같다.
[https://docs.swift.org/swift-book/LanguageGuide/Methods.html]