1 struct TestObserver 2 { 3 void put(int n) 4 { 5 } 6 7 void put(Object obj) 8 { 9 } 10 } 11 12 Observer!int observer = observerObject!int(TestObserver()); 13 observer.put(0); 14 observer.completed(); 15 observer.failure(null); 16 static assert(isObserver!(typeof(observer), int));
Wraps subscribe method in virtual function.