Skip to content

Commit

Permalink
new file: ch21
Browse files Browse the repository at this point in the history
  • Loading branch information
realfirst committed May 1, 2011
1 parent bc3e396 commit dc8d06d
Show file tree
Hide file tree
Showing 16 changed files with 3,573 additions and 0 deletions.
Binary file added ch21/AA
Binary file not shown.
38 changes: 38 additions & 0 deletions ch21/AA.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <iostream>

using namespace std;

class AA {
public:
virtual void something() {
std::cout << "AA::something()" << std::endl;
}
};

class BB : public AA {
public:
void something() {
std::cout << "BB::something()" << std::endl;
}
};

void byvalue(AA x) {
x.something();
}

void byref(AA &x) {
x.something();
}

void byporinter(AA *x) {
x->something();
}

int main(int argc, char **argv) {
BB b;
byvalue(b);
byref(b);
byporinter(&b);

return 0;
}
Loading

0 comments on commit dc8d06d

Please sign in to comment.