Skip to content

Instantly share code, notes, and snippets.

@guilherme
Created July 18, 2011 02:30
Show Gist options
  • Save guilherme/1088432 to your computer and use it in GitHub Desktop.
Save guilherme/1088432 to your computer and use it in GitHub Desktop.
exemplo de tipos de paradigma de programacao
// 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