cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Windows Programming
What C++ syntax is this?
What C++ syntax is this?
Aug 18, 2010 at 12:51pm UTC
benzpinto
(4)
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 UTC
jsmith
(5804)
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 UTC
benzpinto
(4)
Now i see!
It didn't occur to me earlier that type casting can be used for function return value.
Thanks, jsmith! :)
Topic archived. No new replies allowed.