File: main.c

package info (click to toggle)
interface99 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: ansic: 951; sh: 48; makefile: 6
file content (24 lines) | stat: -rw-r--r-- 508 bytes parent folder | download | duplicates (2)
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;
}