int subscribeCount = 0; class TestObservable : Observable!int { Disposable subscribe(Observer!int observer) { subscribeCount++; return NopDisposable.instance; } } auto test = new TestObservable; auto observable = observableObject!int(test); assert(observable is test); assert(subscribeCount == 0); auto d = observable.subscribe(null); assert(subscribeCount == 1);
Wraps subscribe method in virtual function.