Classes (Class) and struct (struct) differences
1. Memory management method is different, class reference type, allocated on the heap. struct value type, allocated on the stack.
2. Class, there is a destructor. The structure cannot have a destructor, and the playground is tested directly to die.
3. Struct constructor, the constructor with parameters is automatically generated. The class does not generate constructors with parameters for properties that have an initialization assignment.
2. Classes have inheritance attributes, structs do not inherit attributes, and there is no natural overload of member properties and member methods, class properties, and class methods.
Because the struct has no inheritance, the operator function needs static modification and cannot be modified by class;
struct:static func + (left:a,right:a), A {...}
class:static func + (left:a,right:a), A {...} or
Final class Func + (LEFT:A,RIGHT:A), A {...}
same Point 1, other advanced features are similar, the structure and class have the characteristics:
operator function, paradigm, protocol adoption, observer
The difference between class and struct in Swift