写了一个c++头文件,麻烦帮我看下有什么问题,还有各个部分的具体作用。

2025-04-08 10:12:13
推荐回答(1个)
回答1:

#ifndef MULTIFLY_H_
#define MULTIFLY_H_
#include
using namespace std;
template 
class mul
{
public:
mul(numtype a,numtype b)
    {
x=a;y=b;
}
numtype multifly() //返回类型错误
    {
//return h=x*y 一、h没定义,二、少了分号结束
return x*y ;
}
private:
numtype x,y; //变量类型错误
} ; //少了分号,类定义结尾要有分号
#endif