yo/inheritance/examples/derivenew.cc
raw| 1 | #include <iostream> |
| 2 | #include <string> |
| 3 | #include <algorithm> |
| 4 | #include <iterator> |
| 5 | |
| 6 | using namespace std; |
| 7 | |
| 8 | struct Xstr: public string |
| 9 | { |
| 10 | Xstr() |
| 11 | : |
| 12 | string("hello world") |
| 13 | {} |
| 14 | }; |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | string *sp = new Xstr[10]; |
| 19 | copy(sp, sp + 10, ostream_iterator<string>{ cout, "\n" }); |
| 20 | } |