xpp {

       /* Define the ancestor class XPlant */

       class XPlant {

              construct {

                     public:

                           <Num upd="false">100</Num>

              }

              public:

                     int    iAge = 5;

       }

 

       /* Define the XTree class which inherits from XPlant but adds nothing else */

       class XTree : XPlant {}

      

       /* Instantiate the MyTree object as an instance of XTree */

       node(XTree)   MyTree;

      

       /* Write the iAge member of MyTree in a sentence */

       xout("\r\nMyTree's age is " + MyTree.iAge + " years old.");

      

       /* Write the upd attribute of the Num child node of the MyTree object */

       xout("\r\nMyTree/Num's upd flag is " + $MyTree/Num.upd);

      

       /* Assign the Barn node to be the new value of MyTree */

       MyTree = $<Barn>500</Barn>;

}