Allright dudes ,listen up .. i am programming C++ about 2 days now , so i am not into it , in any way , so the problem is that the preproceccor macro #define should trigger the constructor , but the problem is that i got that annoying compiler error : "expected primary expression.." (on DEV C++ integrated compiler)
Here's the code :
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std ;
using std::string ;
#define CREATE_TABLE(name) (MyClass mc(name)) //<----- 2 damn hours same shit error msg
string create_table(string name){
return name ;
}
class MyClass
{
public:
MyClass(string name)
{
cout << "class name is :" << name;
}
private:
string name ;
};
int main()
{
CREATE_TABLE(name) ;
std::cin.ignore( std::numeric_limits<streamsize>::max(), '\n' );
}
ty guys..