Skip to content

shadow copy vs deep copy #7

@siddltkfkd

Description

@siddltkfkd

shadow copy

  • 객체의 위치를 참조하는 카피
  • a 객체가 b 객체를 카피했을 때, a의 값을 바꾸면 b의 값도 바뀐다.
  • primitive 타입이 아니라면 복사시 shadow copy를 한다. (ex. 객체, 리스트 등)

deep copy

  • 객체의 값을 복사하는 카피
  • 복사된 객체는 원본과 다른 객체이다.
  • 변수 a가 변수 b를 복사했을 때, a의 값을 바꿔도 b의 값은 바뀌지 않는다.
  • primitive 타입은 복사시 deep copy를 한다.

Metadata

Metadata

Assignees

No one assigned

    Labels

    복습안보고 기억나는대로 적어보기

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions