回复 26楼 BlueGuy
其实面向对象最主要的是,继承和多态,比如在Thinking in C++中有一节是这样说的:Evolution of C++ programmers (C++程序员的演变)
C programmers seem to acquire C++ in three steps.First,as simply a "better C",because C++ forces you to declare all functions before using them and is much pickier about how variables are used.You can often find the errors in a C program simply by compiling it with a C++ compiler.
The second step is "object-based"C++.This means that you easily see the code organization benefits of grouping a data structure together with the functions that act upon it, the value of constructors and destructors,and perhaps some simple inheritance.Most programmers who have been working with C for a while quickly see the usefulness of this because,whenever they create a library,this is exactly what they try to do.With C++,you have the aid of the compiler.
You can get stuck at the object-based level because you can quickly get there and you get a lot of benefit without much mental effort.It's also easy to feel like you're creating data types - you make classes and objects,you send messages to those objects, and everything is nice and neat.
But don't be fooled.If you stop here,you're missing out on the greatest part of the language, which is the jump to true object-oriented programming.You can do this only with virtual functions.
Virtual functions enhance the concept of type instead of just encapsulating code inside structures and behind walls,so they are without a doubt the most difficult concept for the new C++ programmer to fathom.However,they're also the turning point in the understanding of object-oriented programming.If you don't use virtual functions,you don't understand OOP yet.

My life is brilliant