Car

Car.cs
01/* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com */ 02namespace Db4objects.Db4odoc.CommitCallbacks 03{ 04 class Car 05 { 06 private string _name; 07 08 private int _model; 09 10 private Pilot _pilot; 11 12 public Car(string name, int model, Pilot pilot) 13 { 14 _name = name; 15 _model = model; 16 _pilot = pilot; 17 } 18 19 public int Model 20 { 21 set 22 { 23 _model = value; 24 } 25 } 26 27 public Pilot Pilot 28 { 29 set 30 { 31 _pilot = value; 32 } 33 } 34 35 public override string ToString() 36 { 37 return string.Format("Car: {0} {1} Pilot: {2} ", _name, _model, _pilot.Name); 38 } 39 } 40}
Pilot.cs
01/* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com */ 02namespace Db4objects.Db4odoc.CommitCallbacks 03{ 04 class Pilot 05 { 06 private string _name; 07 08 public string Name 09 { 10 get 11 { 12 return _name; 13 } 14 } 15 16 public Pilot(string name) 17 { 18 _name = name; 19 } 20 } 21}

Car.vb
01' Copyright (C) 2007 db4objects Inc. http://www.db4o.com 02Namespace Db4objects.Db4odoc.CommitCallbacks 03 04 Class Car 05 Private _name As String 06 Private _model As Integer 07 Private _pilot As Pilot 08 09 Public Sub New(ByVal name As String, ByVal model As Integer, ByVal pilot As Pilot) 10 _name = name 11 _model = model 12 _pilot = pilot 13 End Sub 14 15 Public WriteOnly Property Model() As Integer 16 Set(ByVal value As Integer) 17 _model = value 18 End Set 19 End Property 20 21 Public WriteOnly Property Pilot() As Pilot 22 Set(ByVal value As Pilot) 23 _pilot = value 24 End Set 25 End Property 26 27 Public Overloads Overrides Function ToString() As String 28 Return String.Format("Car: {0} {1} Pilot: {2} ", _name, _model, _pilot.Name) 29 End Function 30 End Class 31End Namespace
Pilot.vb
01' Copyright (C) 2007 db4objects Inc. http://www.db4o.com 02Namespace Db4objects.Db4odoc.CommitCallbacks 03 04 Class Pilot 05 Private _name As String 06 07 Public ReadOnly Property Name() As String 08 Get 09 Return _name 10 End Get 11 End Property 12 13 Public Sub New(ByVal name As String) 14 _name = name 15 End Sub 16 End Class 17End Namespace