SCherkasov / MyPlayground

0 stars 0 forks source link

You should not store side variable in Square class, take it from parent class, Rectangle #11

Closed igavrysh closed 6 years ago

igavrysh commented 6 years ago

https://github.com/SCherkasov/MyPlayground/blob/fe756032dfaee9036bac01f1014a2dc8c1c4e554/MyPlayground.playground/Contents.swift#L49-L54

  1. Read article an https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/AccessControl.html What access type should height and width variables have, so that they are accessable from child class only?
  2. Make side a calculatable property with only getter e.g. var side: Float { get{ .... } }
  3. Make side a calculatable prop.... Add setter. e.g. var side: Float { get{....} set {....}}
  4. Remove side assigning from Square.init
SCherkasov commented 6 years ago

fixed with you yesterday

igavrysh commented 6 years ago

please, close issues by yourself as long as you push code into repo for this fix