menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Main diffe...
source image

Dev

2M

read

82

img
dot

Image Credit: Dev

Main difference between struct and class.

  • The main difference between struct and class in Swift lies in the way they store and manage data: struct is a value type and class is a reference type.
  • Struct stores independent copies of data, while class shares reference to the same object.
  • Struct does not support inheritance, while class supports inheritance.
  • Class has deinitializer for cleanup when object is removed from memory, and classes can change properties without needing 'mutating' keyword.

Read Full Article

like

4 Likes

For uninterrupted reading, download the app