Skip to content

SerliDojo/wine-app-ios

Repository files navigation

wine-app-ios

An application that consume the serli's wine API

Différence entre class et struct

Both class and structure can do:

  • Define properties to store values
  • Define methods to provide functionality
  • Be extended
  • Conform to protocols
  • Define intialisers
  • Define Subscripts to provide access to their variables

Only class can do:

  • Inheritance
  • Type casting
  • Define deinitialisers
  • Allow reference counting for multiple references.

class

class SomeClass {
    var name: String
    init(name: String) {
        self.name = name
    }
}

var aClass = SomeClass(name: "Bob")
var bClass = aClass // aClass and bClass now reference the same instance!
bClass.name = "MacGyver"

println(aClass.name) // "MacGyver"
println(bClass.name) // "MacGyver"

struct

struct SomeClass {
    var name: String
}

var aClass = SomeClass(name: "Bob")
var bClass = aClass // aClass and bClass now reference the same instance!
bClass.name = "MacGyver"

println(aClass.name) // "Bob"
println(bClass.name) // "MacGyver"

About

An application that consume the serli's wine API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages