In my class, we are studying C++98 so I'm trying to find the proper syntax.
How should one write the declaration:
template <class T>
class A{
public:
A();
A(const A &rhs);
A &operator=(const A &rhs);
};
Or should it be like this:
template <class T>
class A{
public:
A();
A(const A<T> &rhs);
A &operator=(const A<T> &rhs);
};
I guess the implementation is the same for both of them.
Are they different from one to another?
Given
template <class T> class A { ... };
The names A<T>
and A
are both valid names to refer to A<T>
in the scope of the class. Most prefer to use the simpler form, A
, but you may use A<T>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With