About Template

what is the scope of the keyword template?

is template only affect the class or function closest to it?
1
2
3
4
5
6
7
8
9
10
11
  template <typename T>
  T mymax(T x,T y){
    return(x>y)?x:y;
  }

  T mymin(T x,T y){
    return(x<y)?x:y;
  }

  seems that mymin will cause error
I suggest that you rephrase your statement in a better understood format so that others can help you. I don’t know about anyone else, but

"is template only affect the class or function closest to it"

Doesn’t actually make sense to me.
I might just be dumb, but who knows XD
> what is the scope of the keyword template?
> is template only affect the class or function closest to it?

Yes; it applies only to the immediately following declaration or definition.
Topic archived. No new replies allowed.