0

Could anyone give me an example to show the benefit of casting a pointer to an object to a pointer to a function in c++ ?

Thanks

  • Why do you want to cast a pointer to an object to a pointer to a function? They point to different things. Looks like [XY problem](https://en.wikipedia.org/wiki/XY_problem). Refer to a [good c++ book](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). – Jason Sep 05 '22 at 05:52
  • This is most certainly undefined behaviour. I believe you have misconception here, can you show us an example, where this would be needed or explain from where you got this idea? – Lukas-T Sep 05 '22 at 05:54

0 Answers0