/* ********** QUIZ: WHAT LANGUAGE IS THIS?! ********* */ #using #include __gc public class bigobject { public: int x; bigobject(int a) // constructor { x = a; } // destructor not needed }; /* Not Legal: void changeobject(bigobject A) { A.x += 2; } */ /* Legal: */ void changeobject(bigobject *A) { A->x += 2; } int main() { // bigobject A(2); // not legal bigobject *A = new bigobject(2); // legal changeobject(A); cout << "A->x is now " << A->x << endl; // So it likes pointers. Let's try pointer arithmetics: // A++; // oops! not allowed! //delete(A); // memory deallocation not needed return 0; } /* WHAT MOTHER NEVER TOLD YOU ABOUT VISUAL C++ .NET Screenplay by Chuck Liang Mother: What programming language are you using now, sweetheart? Man: Visual C++ .Net, just like you taught me mom. Mother: I hear that a lot of people are using Java. Have you thought about using that? Man: Java is for wimps who believe what their professors teach them about abstraction, scalability, type safety, and all that baloney. REAL MEN DON'T USE JAVA. And I'm a real man, mom. Mother: Oh, I see, um, OK, but there is something that I never told you about Visual C++ .Net Man: What is it that you're trying to tell me, mom? Mother: THAT IT'S ACTUALLY JAVA IN DISGUISE. Man: NOOOOOOOOOOOOOOOO! What kind of mother are you?! Why didn't you tell me the truth?! Mother: But sweetheart, you were writing programs with all kinds of errors. You don't really understand how to use pointers, type casting, memory management, how C++ does inheritance, among other things. I was afraid you'll write a really bad program someday. Man: NO, NO, NO! It can't be true! You mean I've been a &$#@* Java programmer all this time?! This is the worst day of my life!! Mother: I knew how much you hated to be called a Java programmer, so I had to think of a way to get you to program in Java without thinking that you were programming in Java. But don't worry dear, you're still a real man to me! Man: OK, I'll trust you one last time, but it better not happen again! Mother: Oh, um, of course not, dear ... */