Created
July 18, 2011 02:30
-
-
Save guilherme/1088432 to your computer and use it in GitHub Desktop.
exemplo de tipos de paradigma de programacao
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
// Orientado a Objeto (Ruby) | |
class Evento | |
def consumir | |
puts "Estou consumido" | |
end | |
end | |
class FilaDeEventos | |
def consumirUltimo | |
ultimo.consumir() | |
end | |
end | |
FilaDeEventos fila; | |
while(true) { | |
fila.consumirUltimo(); | |
} | |
// Procedural (c) | |
typedef struct { | |
char eventos[]; | |
char *ultimo; | |
} FilaDeEventos; | |
FilaDeEventos fila; | |
void consumirUltimoEvento (FilaDeEventos fila) { | |
void consumir(fila.ultimo); | |
} | |
void consumir(char *evento) { | |
printf("%s", evento); | |
} | |
while(true) { | |
consumirUltimoEvento(fila); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment