예제 #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
파일: test_lua.cpp 프로젝트: astrellon/GPP
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;
}