Aug 18, 2010 at 12:51pm Aug 18, 2010 at 12:51pm UTC
Hi guys, this is my first post. I've been learning C++ for about a year and now started to learn windows API using MFC. Here i found a syntax that i don't recall ever seeing in C++:
void MySideApp::OnButton1()
{
((MyMainApp *)AfxGetApp())->m_Missile.Launch();
}
Is this some sort of a pointer method that i've missed out in C++:
(MyMainApp *)AfxGetApp()
Thanks in advance,
Ben
Aug 18, 2010 at 1:13pm Aug 18, 2010 at 1:13pm UTC
It is casting the return value of AfxGetApp() to a MyMainApp*, then calling Launch() on data member m_Missile.
Aug 18, 2010 at 1:22pm Aug 18, 2010 at 1:22pm UTC
Now i see!
It didn't occur to me earlier that type casting can be used for function return value.
Thanks, jsmith! :)