This file contains hidden or 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
// create class | |
class Bike { | |
var name = "" | |
var gears = 0 | |
} | |
// create object of class | |
var bike1 = Bike() |
This file contains hidden or 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
class Bike { | |
var name = "" | |
var gear = 0 | |
} |
This file contains hidden or 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
protocol Greet { | |
// blueprint of a property | |
var name: String { get } | |
// blueprint of a method | |
func message() | |
} |
This file contains hidden or 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
print(taylor.clothes) | |
print(other.shoes) |
This file contains hidden or 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
let taylor = Person(clothes: "T-shirts", shoes: "sneakers") | |
let other = Person(clothes: "short skirts", shoes: "high heels") |
This file contains hidden or 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
struct Person { | |
var clothes: String | |
var shoes: String | |
} |
This file contains hidden or 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
-T link.ld -melf_i386 # emulate 32 bits ELF, the binary output is specified | |
# in the linker script |
This file contains hidden or 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
-m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfiles | |
-nodefaultlibs |
This file contains hidden or 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
OUTPUT_FORMAT("binary") /* output flat binary */ | |
SECTIONS | |
{ | |
. = 0; /* relocate to address 0 */ | |
.text ALIGN(4): | |
{ | |
start.o(.text) /* include the .text section of start.o */ | |
*(.text) /* include all other .text sections */ |
This file contains hidden or 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
extern kmain | |
section .text | |
; push argv | |
; push argc | |
call kmain | |
; main has returned, eax is return value | |
jmp $ ; loop forever |
NewerOlder