Constructing Objects and Calling Member functions

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

Here is my code

#include 

using namespace std;

class MyTestClass
{
    int MyTestIVar;

    public: 
        MyTestClass(void);
        int         


        
2条回答
  •  误落风尘
    2021-01-16 23:54

    You have stumbled upon the most vexing parse.

    The line

    MyTestClass mTC();
    

    is parsed as a function prototype of a function named mTC which has no arguments and returns an instance of MyTestClass.

提交回复
热议问题