首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

define的用法?解决办法

2013-07-09 
define的用法??我定义了宏#define a 2,1class CBit{CBit( int bit)CBit( int axis,int act)}class CIO{g

define的用法??
我定义了宏
#define a 2,1

class CBit
{
   CBit( int bit);
   CBit( int axis,int act);
}

class CIO
{
    get_in(CBit &BIT);
}

当  
   CIO in;
   in.get_in(CBit(a));
为什么 a这里调用的 是  CBit( int bit)??
什么原因导致如此???
如果直接 in.get_in(CBit(2,1))又没问题??
求解!!!!!!!!!!
[解决办法]
http://codepad.org/TRsUpS3P

你的代码是别的问题。
[解决办法]
我这边测试调用的是双参数的那个
[解决办法]
我这边调用的也是双参数那个
[解决办法]
Test.cpp

#include "Test.h"


CBit::CBit(int bit)
{
}

CBit::CBit( int axis,int act)
{

}

CBit::~CBit(void)
{
}

void CIO::get_in(CBit &BIT)
{

}


Test.h
#pragma once

#define a 2,1


class CBit
{
public:
~CBit(void);
   CBit( int bit);
   CBit( int axis,int act);
};

class CIO
{
public:
  void get_in(CBit &BIT);
};


调用

CIO in;
in.get_in(CBit(a));


应该就这样了吧,简单的测试
[解决办法]
看看编译器把宏展开后的代码

热点排行
Bad Request.