Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class T>
- class Set
- {
- public:
- T ch;
- set <T> cs; //создаем множество
- Set()
- {
- int n;
- T temp;
- cout << "Количество элементов множества";
- cin >> n;
- for (int i = 0; i < n; i++)
- {
- cin >> temp;
- cs.insert(temp);
- }
- }
- template <class T>void operator * (Set <T> second)
- {
- //Как обратиться к first?
- second.Print();
- }
- void Print()
- {
- set <T>::iterator ik;
- for (ik = cs.begin(); ik != cs.end(); ++ik)
- cout << *ik << " ";
- cout << endl;
- }
- };
- int _tmain(int argc, _TCHAR* argv[])
- {
- setlocale(LC_ALL,"ru");
- Set<char>first;
- first.Print();
- first = first + 'd';
- first.Print();
- Set<char>second;
- second.Print();
- first*second;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement