显示 illegal use of type 'void'如何解决


#include <iostream>
using namespace std;
class complex{
public:
    complex(int r,int v);
    complex(float r);
    void add(complex &c);
    void show();
private:
    float real;
    float vir;
};
complex::complex(int r,int v):real(r),vir(v){
    
}
complex::complex(float r):real(r){}

void complex::add(complex &c){
    real=c.real;
}

void complex::show{//在这一行显示错误
    cout<<real<<'+'<<vir<<i<<endl;
}

int main(){
    complex c1(3,5);
    complex c2=4.5;
    c1.add(c2);
    c1.show();
    return 0;

}

void complex::show() 中的括号掉了,另外,这里面的 i 也没定义

img