message Vehicles {
Any extending = 1;
}
// cpp code ==================
Car car = new Car();
UnpackAny(vehicles.extending, &car);
On Mon, Jun 5, 2017 at 11:48 AM R.C. <[email protected]> wrote:
> Hi,
>
> I am looking to move an application written with proto2 to use proto3. I
> understand 'extensions' is disabled in proto3 and am looking for some
> guidance to change the below to proto3:
>
>
> ========================
> common.proto:
>
> message Vehicles {
> extensions 1 to max
> }
>
> ========================
> car.proto:
>
> import "common.proto";
>
> message Car {
> string type = 1;
> string color = 2;
> }
>
> extend Vehicles {
> optional Car CarExt = 100;
> }
>
> ========================
>
> bike.proto:
>
> import "common.proto";
>
> message Bike {
> string type = 1;
> string color = 2;
> }
>
> extend Vehicles {
> optional Bike BikeExt = 200;
> }
> ========================
>
> Since 'optional' is default i can remove the 'optional' keyword but I am
> not sure how 'Any' can be used in such scenario in the place of
> 'extensions'.
>
> Thanks,
> rc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.