> If a static data member is of const integral or > const enumeration type, its declaration in the class > definition can specify a constant-initializer which > shall be an integral constant expression (5.19).
-3- Member functions, including virtual functions (class.virtual), can be called during construction or destruction (class.base.init). When a virtual function is called directly or indirectly from a constructor (including from the mem-initializer for a data member) or from a destructor, and the object to which the call applies is the object under construction or destruction, the function called is the one defined in the constructor or destructor's own class or in one of its bases, but not a function overriding it in a class derived from the constructor or destructor's class, or overriding it in one of the other base classes of the most derived object (intro.object). If the virtual function call uses an explicit class member access (expr.ref) and the object-expression refers to the object under construction or destruction but its type is neither the constructor or destructor's own class or one of its bases, the result of the call is undefined. [Example:
------------(インデントはスマン) class A { A() { v(); } public void v() { System.out.println("A#v"); } } class B extends A { String s; B() { s="hello"; v(); } public void v() { System.out.println("B#v s="+s); } }
public class test { public static void main(String[] argv) { // A a = new A(); B b = new B(); } }
class A { public: virtual void method(void); } class B : public A { ... }; class C : public A, public B { virtual void Cmethod(void); // ここで B の仮想関数 method をオーバーライドして // Cmethod()を使いたいのですが、書き方が分からないです。 };