Hi everyone,

here is my question

I wrote a class as follows

I want to output the numbers if sh(n)==2or3or5or7

the problem is that error appears

C2440 cannot convert from 'int' to 'sh'

I know that the sh() in class sh cannot return numbers

but I don't know how to fix this problem.

thanks for helping.

Code:

class sh:public Item{
int n;
public:
int out();
int th(int x){
int sum=0;
for(int i=10;n>0;){
sum+=x%10;
x=x/10;
} return x;
}
sh(Item *src,int x):Item(src){
while(x>10){
x=th(x);
}
}
};
int sh::out() {
int n=source->out();
source=new Filter(source,n);
if(sh(n)==2||3||5||7) return n;
}