Пример #1
0
int main() {
 
  cout << "sizeof(Parent) = " << sizeof(Parent) << endl;
  cout << "sizeof(Child) = "
       << sizeof(Child) << endl;

  Child C;
  
  C.change();
  C.printAge();

  C.increaseAge();
  C.printAge();
 


  C.Parent::setAge(50); //Invoke parent version
  C.setAge(55);
  C.printAge();

  C.printSSN();
 
  //  Parent P;

  //P.increaseAge();
  //P.printAge();
 
}
Пример #2
0
int Child_set_age(lua_State *lua)
{
    Child *child = castUData<Child>(lua, 1);
    if (child && lua_isnumber(lua, 2))
    {
        child->setAge(lua_tointeger(lua, 2));
    }
    return 0;
}