Skip to content

Instantly share code, notes, and snippets.

@ramntry
Created October 7, 2014 09:09
Show Gist options
  • Select an option

  • Save ramntry/5a67f089c5b5725c721b to your computer and use it in GitHub Desktop.

Select an option

Save ramntry/5a67f089c5b5725c721b to your computer and use it in GitHub Desktop.
#include "header_a.h"
bool A::even(int n) {
return n == 0 || B().odd(n - 1);
}
#include "header_b.h"
bool B::odd(int n) {
return !(n == 0 || !A().even(n - 1));
}
#pragma once
#include "header_b.h"
class A {
public:
bool even(int n);
};
#pragma once
#include "header_a.h"
class B {
public:
bool odd(int n);
};
#include <cassert>
#include "header_a.h"
#include "header_b.h"
int main() {
assert(A().even(0));
assert(A().even(2));
assert(B().odd(1));
assert(B().odd(3));
return 0;
}
test: main.o a.o b.o
g++ $^ -o $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment