c++ - Cant static cast class to integer -
why getting error when seek static cast element* int
typedef element* elementptr int element::getvp (elementptr item) { homecoming static_cast <int>(item); // have class called element }
not sure what's question, sense want implicit conversion function. convert element
int, want operator int()
struct element { operator int() { homecoming i; } int i; }; int element::getvp (element* item) { homecoming (*item); // have class called element }
but it's still not clear why need getvp
in element class.
it' show how convert struct/class int type. i'll delete reply if it's not want.
c++ static-cast
No comments:
Post a Comment