Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- #include <iterator>
- #include <stdlib.h>
- using namespace std;
- class Test {
- private: int id;
- public:
- Test(int id) {
- this->id = id;//builder
- }
- void Show() {
- cout << id << '\n';
- }
- };
- void ShowLista(list <Test> test) {
- for (list <Test> ::iterator it = test.begin(); it != test.end(); it++)it->Show();
- }
- int main() {
- list <Test> test; // lista
- test.push_front(2); // aduagam in fata
- test.push_back(1); // aduagam in spate se apeleaza constroctorul
- test.push_front(100);// adaugam in fata
- ShowLista(test);// afisam
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement