Structure & Classes are general-purpose, flexible constructs that become the building blocks of our program's code.
Syntax:
Are you confused about Structures & Classes ?
Classes use reference counting. It means more than one variable can reference a class instance whereas Structures are values which are always copied when they are passed around.
Structures
In this tutorial we are going to do some basic operations on a very simple struct.
What all we can do with the structure ?
Syntax:
Are you confused about Structures & Classes ?
Classes use reference counting. It means more than one variable can reference a class instance whereas Structures are values which are always copied when they are passed around.
Structures
What all we can do with the structure ?
- Defining properties to store values
- Defining methods to provide functionality
- Defining subscripts to provide access to their values using subscript syntax
- Defining initialisers to set up their initial state
- Be extended to expand their functionality beyond a default implementation
- Conform to protocols to provide standard functionality of a certain kind
No comments:
Post a Comment