I'm not sure what you mean by dangerous.

It's just in general a good practice to only have the same-signature methods to be either virtual or static on derived classes. A lot of hard-to-see bugs were
introduced by something like this:

class A {
  void Method() { printf("A"); }
}

class B : public A {
  void Method() { printf("B"); }
}


B* objectB = new B();
A* base = objectB;
base->Method();

This can be quite confusing, especially in a variant where someone decides to
make Method a 'virtual' - but only on B.

One example of the same rule is a requirement to have a virtual destructor on a
base class of derived hierarchy.


http://codereview.chromium.org/3139005/show

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to