CS246 Lecture Notes - Lecture 19: Run-Time Type Information, Standard Template Library, Iterator

19 views3 pages

Document Summary

November 17 template method pattern, c++ templates, visitor design pattern. Dosort() - dosort() void sort(){ input(); dosort(); output(); Sort *s = new (merge or bubble) s->sort(); Want to implement different types of sorts. Turtle *t = new [ red / green ] t->draw(); Draw is not virtual, given a turtle pointer, can call the method. Drawhead, drawtail not virtual, cannot be overridden by subclasses. T getdata() const { return data; } void setnext(node _next){ next = _next; } Node *intlist = new node(2, new node(3, null)); Node *charlist = new node( a", new node( b", null)); Vector v; v. push_back(1); v. push_back(2); for(int i=0; i::iterator it = v. begin(); it != v. end(); ++it){ cout << *it << endl;

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents