1

Suppose, I have a Base class and a Foo class derived from Base:

class Base {
}

class Foo : Base {
}

I'm writing the protobuf protocol to use their methods.

They share some functionality, is there a way to avoid rewriting code by passing the service?

For example:

service BaseProto {
   rpc SomeFunction (Request) returns (Response)
}

service FooProto {
   **Passing the service here instead of rewriting SomeFunction()
}

I'm working with C#, ProtoBuf 3.0.

Azeem
  • 11,148
  • 4
  • 27
  • 40
  • Language? Proto version? – Azeem May 27 '20 at 06:26
  • My bad, I've edited my massage. – Rony Kositsky May 27 '20 at 06:43
  • Please verify my edit. – Azeem May 27 '20 at 06:51
  • According to the [documentation](https://developers.google.com/protocol-buffers/docs/proto3#services), it generates the interface code and stubs for the service. And, you are responsible for the implementation. `Foo` is inheriting its parent's behavior so I believe that you can easily use the shared functionality in your implementation. – Azeem May 27 '20 at 06:57

0 Answers0