C
chsalvia
Is virtual inheritance ambiguity resolution ever performed statically,
i.e. at compiler time? Or is it always resolved at runtime?
In other words, if you use virtual inheritance, but don't use
polymorphism (pointers to derived classes), is there any overhead?
Take the following example:
class Base {
public:
int x;
void func1() { x = 2; }
};
class A : public virtual Base {
public:
int y;
};
class B : public virtual Base {
public:
int z;
};
class Derived : public A, public B {
public:
};
int main() {
Derived d;
d.func1(); // does this function call entail additional
overhead?
}
i.e. at compiler time? Or is it always resolved at runtime?
In other words, if you use virtual inheritance, but don't use
polymorphism (pointers to derived classes), is there any overhead?
Take the following example:
class Base {
public:
int x;
void func1() { x = 2; }
};
class A : public virtual Base {
public:
int y;
};
class B : public virtual Base {
public:
int z;
};
class Derived : public A, public B {
public:
};
int main() {
Derived d;
d.func1(); // does this function call entail additional
overhead?
}