E
Elad
Hello All,
Im taking an OOP course, in one of the tutorials, there was a frozen
class example, i.e. a class which is impossible to inherit from, the
example was something like:
struct ice__ {
ice() {};
};
class Frozen : private virtual ice__ {
Frozen () {}; // Will call ice__'s default c'tor, which is OK.
};
class Violation : public Frozen {
Violation () {}; // Must call ice__'s c'tor which is impossible.
};
As I understand, since Frozen virtually inherits ice__, Violation which
inherits Frozen must call ice's c'tor, which is impossible, as ice's
c'tor is in the private part of Frozen.
nevertheless, this example compiles and executes just fine under g++
with ansi / pedantic flags. cl (MS's compiler) eats this as well.
any clue ?
Thanks,
Elad.
Im taking an OOP course, in one of the tutorials, there was a frozen
class example, i.e. a class which is impossible to inherit from, the
example was something like:
struct ice__ {
ice() {};
};
class Frozen : private virtual ice__ {
Frozen () {}; // Will call ice__'s default c'tor, which is OK.
};
class Violation : public Frozen {
Violation () {}; // Must call ice__'s c'tor which is impossible.
};
As I understand, since Frozen virtually inherits ice__, Violation which
inherits Frozen must call ice's c'tor, which is impossible, as ice's
c'tor is in the private part of Frozen.
nevertheless, this example compiles and executes just fine under g++
with ansi / pedantic flags. cl (MS's compiler) eats this as well.
any clue ?
Thanks,
Elad.