/* Overview: 1. not survey of languages but different types of languages 2. not about syntax (might as well be about fonts) 3. It is about what's important in languages versus what's superficial */ #include #include #include using namespace std; void f1(int x, int y) // "call by value" { int z = x; x = y; y = z; } void f2(int* x, int* y) // "call by value" but value type is pointer { int *z = x; x = y; y=z; /* int z = *x; *x = *y; *y = z; */ } void f3(int& x, int& y) // "call by reference" { int z = x; x = y; y = z; } int f(int x) { cout << "in f, returning 0" << endl; return 0; } int g(int x) { cout << "in g, returning " << x*x << endl; return x*x; } class account { private: string name; string password; double balance; public: account(string n, double init) { name = n; balance = init; password = "xyzzy"; } void withdraw(double amt) { string pw; cout << "Enter password: "; cin >> pw; if (pw==password && amt>0 && amtpassword << endl; youracc->balance = -50000; youraccount.info(); return 0; }