Add POC example of inheritance for testing

pull/13288/head
ncteisen 7 years ago
parent 54e8f37e53
commit 344553c27c
  1. 3
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  2. 14
      src/core/ext/transport/chttp2/transport/internal.h

@ -274,6 +274,9 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
GPR_ASSERT(strlen(GRPC_CHTTP2_CLIENT_CONNECT_STRING) ==
GRPC_CHTTP2_CLIENT_CONNECT_STRLEN);
t->abstract = new D1;
t->abstract->foo();
t->base.vtable = get_vtable();
t->ep = ep;
/* one ref is for destroy */

@ -237,12 +237,26 @@ typedef enum {
GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED,
} grpc_chttp2_keepalive_state;
class AbstractBase {
public:
AbstractBase() {}
virtual void foo() { gpr_log(GPR_ERROR, "base"); }
};
class D1 : public AbstractBase {
public:
D1() {}
void foo() override { gpr_log(GPR_ERROR, "derived"); }
};
struct grpc_chttp2_transport {
grpc_transport base; /* must be first */
gpr_refcount refs;
grpc_endpoint* ep;
char* peer_string;
AbstractBase* abstract;
grpc_combiner* combiner;
/** write execution state of the transport */

Loading…
Cancel
Save