Constructing Objects and Calling Member functions

前端 未结 2 708
北荒
北荒 2021-01-16 23:32

Here is my code

#include 

using namespace std;

class MyTestClass
{
    int MyTestIVar;

    public: 
        MyTestClass(void);
        int         


        
2条回答
  •  孤独总比滥情好
    2021-01-17 00:05

    MyTestClass mTC();    
    

    Does not declare an object of the MyTestClass class, as you think.

    It Actually, declares a function by the name of mTC which does not take any parameters and returns an MyTestClass object.

    This is known as the Most Vexing Parse in c++.

提交回复
热议问题