O'Reilly logo

Swift Functional Programming - Second Edition by Dr. Fatih Nayebi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Classes versus structures

This section compares classes and structures:

  • Inheritance enables one class to inherit the characteristics of another
  • Type casting enables us to check and interpret the type of a class instance at runtime
  • De-initializers enable an instance of a class to free any resources it has assigned
  • Reference Counting allows more than one reference to a class instance
  • Structures are value types so they are always copied when they are passed around in code
  • Structures do not use Reference Counting
  • Classes are reference types

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required