c# - Is this how we create a structural object hierarchy (object model) like Excel VBA? -


i want learn how create object hierarchy (like of excel vba). have written code , want ask if right way go. also, want know if creating type of object structure have significant effect on performance. access objects e.g. way :

hotel hotel = new hotel();  int x = hotel.rooms[1].count; // example  int y = hotel.rooms.room.count; // example      class hotel     {         private int i;         public hotel()         {             = 10; // prossessing give value of i. lets 10         }         public _rooms rooms         {             { return new _rooms(i); }         }     }     class _rooms     {         private int _i;         public _rooms(int i)         {             this._i = i;         }         public _room this[int i]         {             { return new _room(_i); }         }          public _room room // _room property         {             { return new _room(this._i); }         }     }     class _room     {         private int _i;         public _room(int i)         {             // prossessing give value of i. lets :             _i = + 10;         }         public int count         {              { _i = 15; return _i; }         }     } 

this simple example of model want achieve.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -