C++匿名对象调用成员函数
生活随笔
收集整理的這篇文章主要介紹了
C++匿名对象调用成员函数
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
看例子(VS2008成功測試):
#include "stdafx.h" #include <iostream>using namespace std;class Test { public:bool Fun(){cout<<"1111111";return true;} }; int _tmain(int argc, _TCHAR* argv[]) {if (Test().Fun()){return 0;}return 0; }干C++好幾年了,還真沒有見過這種調用方式,今天發現了,試了一下,確實可以總結
以上是生活随笔為你收集整理的C++匿名对象调用成员函数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C++的Json解析库:jsoncpp和
- 下一篇: Windows下编译和安装Boost库