인스턴스, 프로퍼티, 매서드 차이점 (Difference between Instance, Property, Method)

PM077·2023년 5월 17일
0

iOS

목록 보기
21/21

인스턴스 (Instance)

Swift의 인스턴스는 클래스,구조체,열거형에서 생성된 객체를 말한다

var zeroSevenSevenTech : Student = Student()

여기서 zeroSevenSevenTech가 인스턴스

프로퍼티 (Property)

Swift의 프로퍼티는 클래스, 구조체, 열거형과 관련이 있는 정보나 값을 말한다

struct VideoFrame {
	var width : Int
    var height : Int
}

여기서 width나 height가 프로퍼티

메서드 (Method)

Swift의 메서드는 클래스, 구조체, 열거형과 연관된 함수를 의미한다

class ExampleClass{
	func exampleMethod(){
    	print("메서드 입니다")
    }
    
    func printWords(word : String){
    	return word
    }
}

여기서 exampleClass()와 printWords()가 메서드

profile
PM/PO

0개의 댓글