1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
// This example demonstrates how to implement interfaces for opaque types.
// Note: you can export interface implementations outside of a TU for non-opaque types in the same
// way.
#include "croak.h"
#include "frog.h"
/*
* Output:
* Paul: croak!
* Steve: croak!
*/
int main(void) {
Frog *paul = Frog_new("Paul");
Frog *steve = Frog_new("Steve");
VCALL(DYN(Frog, Croak, paul), croak);
VCALL(DYN(Frog, Croak, steve), croak);
Frog_free(paul);
Frog_free(steve);
return 0;
}
|