????????????????????class???????????????????????????
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <typename T>
class testClass
{
public:
static const int a = 5;
static const long b = 3L;
static const char c = 'c';
static const double d = 100.1;
};
int main()
{
cout << testClass<int>::a << endl;
cout << testClass<int>::b << endl;
cout << testClass<int>::c << endl;
//????????????????????????趨?????????????????в????????????
cout << testClass<int>::d << endl;
system("pause");
return 0;
}
increment??++?????????????????????dereference??*?????
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class INT
{
friend ostream& operator<<(ostream& os?? const INT& i);
public:
INT(int i) :m_i(i) {};
//??????????
INT& operator++()
{
++(this->m_i);
return *this;
}
//????????????
const INT operator++(int)
{
INT temp = *this;
++(this->m_i);
return temp;
}
//??
int& operator*() const
{
return (int&)m_i;
//??????????????????int&????????e???const int?????????趨??
//return m_i;
}
private:
int m_i;
};
ostream& operator<<(ostream& os?? const INT& i)
{
os << '[' << i.m_i << ']' << endl;
return os;
}
int main()
{
INT I(5);
cout << I++;
cout << ++I;
cout << *I;
system("pause");
return 0;
}