in this question they said that
What is the difference between const int*, const int * const, and int const *?
const int * == int const *
OK this true
but when i use it in objects (in my case direct3ddevice and GUI Objects from CEGUI Library )
look at this
void GUI_Menu::Add_Popup( MenuItem const *Parent ,const String &Name )
{
PopMenu.resize (Popup_Menu_ID+1 );
PopMenu.at (Popup_Menu_ID) = static_cast <PopupMenu*> (CEGUI::WindowManager::getSingletonPtr()->createWindow ("TaharezLook/PopupMenu" , Name));
Parent->addChildWindow (PopMenu.at (Popup_Menu_ID));
Popup_Menu_ID++ ;
}
this code will compile error in the following line
Parent->addChildWindow (PopMenu.at (Popup_Menu_ID));
i will explain why it's wrong (in my point) and tell is this false or true ;
MenuItem is a class contain data and function , and those data must updated in needed
as example ( settext , color , size ....etc ) ;
now if i create new MenuItem Obj like this ;
MenuItem const *Obj
what is mean that...OK
this mean that we can't change the data inside the obj but we can change the address
in other world
value is constant but the address is not so , if we want to change color , size ...etc we can't and we get error ...............is this true ;
in other hand we have the same code but with change the constant according.
void GUI_Menu::Add_Popup( MenuItem *const Parent ,const String &Name )
{
PopMenu.resize (Popup_Menu_ID+1 );
PopMenu.at (Popup_Menu_ID) = static_cast <PopupMenu*> (CEGUI::WindowManager::getSingletonPtr()->createWindow ("TaharezLook/PopupMenu" , Name));
Parent->addChildWindow (PopMenu.at (Popup_Menu_ID));
Popup_Menu_ID++ ;
}
we change the following line
MenuItem *const Parent
the new line is mean that we can change value but no change the address so
obj *const a = obj const *b
is wrong !!!