Int) { companion object { var serialNumber: Int = 0 fun createRobot(): Robot = Robot(serialNumber++) } } // How to use it val someRobot = Robot.createRobot()
Int) { companion object { var serialNumber: Int = 0 fun createRobot(): Robot = Robot(serialNumber++) } } // How to use it val someRobot = Robot.createRobot()
Int) { companion object { var serialNumber: Int = 0 fun createRobot(): Robot = Robot(serialNumber++) } } // How to use it val someRobot = Robot.createRobot()
Int) { companion object { var serialNumber: Int = 0 fun createRobot(): Robot = Robot(serialNumber++) } } // How to use it val someRobot = Robot.createRobot()
Int) { companion object { var serialNumber: Int = 0 fun createRobot(): Robot = Robot(serialNumber++) } } // How to use it val someRobot = Robot.createRobot()
Int) { companion object { var serialNumber: Int = 0 fun createRobot(): Robot = Robot(serialNumber++) } } // How to use it val someRobot = Robot.createRobot()
Mechanical Men class USR { private val factory : RobotFactory = Nestor4_Factory() fun produceRobots(quantity: Int): List<Robot> = List(quantity) { factory.createRobot() } } fun main(args: Array<String>) { val usr = USR() // will produce a thousand robots usr.produceRobots(1000) }
Mechanical Men class USR { private val factory : RobotFactory = Nestor4_Factory() fun produceRobots(quantity: Int): List<Robot> = List(quantity) { factory.createRobot() } } fun main(args: Array<String>) { val usr = USR() // will produce a thousand robots usr.produceRobots(1000) }
Mechanical Men class USR { private val factory : RobotFactory = Nestor4_Factory() fun produceRobots(quantity: Int): List<Robot> = List(quantity) { factory.createRobot() } } fun main(args: Array<String>) { val usr = USR() // will produce a thousand robots usr.produceRobots(1000) }
Mechanical Men class USR { private val factory : RobotFactory = Nestor4_Factory() fun produceRobots(quantity: Int): List<Robot> = List(quantity) { factory.createRobot() } } fun main(args: Array<String>) { val usr = USR() // will produce a thousand robots usr.produceRobots(1000) }
Mechanical Men class USR { private val factory : RobotFactory = Nestor4_Factory() fun produceRobots(quantity: Int): List<Robot> = List(quantity) { factory.createRobot() } } fun main(args: Array<String>) { val usr = USR() // will produce a thousand robots usr.produceRobots(1000) }
Mechanical Men class USR { private val factory : RobotFactory = Nestor4_Factory() fun produceRobots(quantity: Int): List<Robot> = List(quantity) { factory.createRobot() } } fun main(args: Array<String>) { val usr = USR() // will produce a thousand robots usr.produceRobots(1000) }
Mechanical Men class USR { private val factory : RobotFactory = Nestor5_Factory() fun produceRobots(quantity: Int): List<Robot> = List(quantity) { factory.createRobot() } } fun main(args: Array<String>) { val usr = USR() // will still produce a thousand robots usr.produceRobots(1000) }
of the Builder design pattern is to separate the construction of a complex object from its representation. By doing so the same construction process can create different representations.
the Builder design pattern is to separate the construction of a complex object from its representation. By doing so the same construction process can create different representations.