I'm having a problem working out how to assign a nested object's value
in C++ (my Java version works fine).  E.g. in the proto file for my
car object I define:

  import "mycustomengine.proto";
  message MyCar {
  optional string name = 1;
  optional string model = 2;
  optional MyCustomEngine customengine  = 3;

Note I have assigned there to only be 0 or 1 MyCustomEngines to a Car
object.  Now in my code, I've already created an instance of
MyCustomEngine, e.g.:

  my::objects::MyCustomEngine myCustomEngine;
  myCustomEngine.set_name("hey, this is my custom engine!");

Now I create my Car object....

  my::objects::MyCar myCar;

But now I'm stuck on how to assign the myCustomEngine instance to the
myCar instance?  There appears to be no method such as
"myCar.set_customengine(myCustomEngine)".  So any ideas on how to do


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to