Design Patterns in Swift: A Different Approach to Coding with Swift by Vamshi Krishna

Design Patterns in Swift: A Different Approach to Coding with Swift by Vamshi Krishna

Author:Vamshi Krishna [Krishna, Vamshi]
Language: eng
Format: epub
Publisher: FV Press
Published: 2018-07-25T23:00:00+00:00


var description: String{

if t20Batsman.strikeRate > 130 && t20Bowler.economyRate < 8 {

return "Fit as T20 AllRounder"

}

else{

var buffer = ""

buffer += t20Batsman.makeRuns()

buffer += " & " + t20Bowler.bowlEconomically()

return buffer

}

}

}

We now define a class for T20AllRounder conforming to CustomStringConvertible. All rounder is someone in cricket who can bat and bowl reasonably well. It has four private variables, strikeRate and economyRate of type Int and Float, along with two more variables of type T20Batsman and T20Bowler.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.