Created
September 2, 2014 00:59
-
-
Save nataliepo/8832a66594af4082b93c to your computer and use it in GitHub Desktop.
Vehicle-Car
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CarFactory.swift | |
// test1 | |
// | |
// Created by Alex Meckes on 9/1/14. | |
// Copyright (c) 2014 Alex Meckes. All rights reserved. | |
// | |
import Foundation | |
class Vehicle { | |
var hasFourWheelDrive = false | |
var numberOfWheels = 0 | |
var numberOfPassengers = 0 | |
init() { | |
println("[Vehicle::init]") | |
} | |
} | |
class Car : Vehicle { | |
var name = "" | |
var color = "" | |
var horsepower = 0 | |
var automaticOption = false | |
init() { | |
super.init() | |
println("[Car::init]") | |
// leave all of this class's variables as default, | |
// but, set the parent's number of wheels. | |
numberOfWheels = 4 | |
} | |
func soupUpHorsepower (var valueToIncrease: Int) -> Int { | |
horsepower += valueToIncrease | |
return horsepower | |
} | |
} | |
func mullOverCarOptions() { | |
println("I think I want a Corvette.") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment