From 6776303862c0a4c57a1d14f5defd48349422cff2 Mon Sep 17 00:00:00 2001 From: arthurwrls Date: Fri, 2 Dec 2022 23:56:21 +0200 Subject: [PATCH] File added --- .../Contents.swift | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Codecademy.playground/Pages/Classes - are reference types.xcplaygroundpage/Contents.swift diff --git a/Codecademy.playground/Pages/Classes - are reference types.xcplaygroundpage/Contents.swift b/Codecademy.playground/Pages/Classes - are reference types.xcplaygroundpage/Contents.swift new file mode 100644 index 0000000..09624e9 --- /dev/null +++ b/Codecademy.playground/Pages/Classes - are reference types.xcplaygroundpage/Contents.swift @@ -0,0 +1,23 @@ + +class Order { + var items = [""] + var subtotal = 0.0 + var tip = 0.0 + var total = 0.0 + + init(items: [String], subtotal: Double, tip: Double, total: Double) { + self.items = items + self.subtotal = subtotal + self.tip = tip + self.total = total + } +} + +var order1 = Order(items: ["Chili Fries", "Lemonade"], subtotal: 8.75, tip: 2.0, total: 12.75) + + +var order8 = order1 +order8.total = 0.0 + +print(order1.total) +print(order8.total)