Anonymous classes
问题 In Java, it's common to write the following (e.g. for event handling) in order to make use of the template method pattern: abstract class SomeAbstractClass { public abstract void SomeFunction (); } //... SomeAbstractClass obj = new SomeAbstractClass () { public void SomeFunction () { /* implementation */ } }; In C++, the following compiles: class SomeAbstractClass { virtual void SomeFunction () = 0; }; // ... SomeAbstractClass * obj = new ( class : public SomeAbstractClass { virtual void