V
Victor Bazarov
Yes. See FAQ, please. And, please, ALWAYS see FAQ before posting.Shuckey said:Is it possible to define a sterile class in C++? That is, a class that
cannot be inherited from?
Yes. See FAQ, please. And, please, ALWAYS see FAQ before posting.Shuckey said:Is it possible to define a sterile class in C++? That is, a class that
cannot be inherited from?
Shuckey said:Hello.
Is it possible to define a sterile class in C++? That is, a class that
cannot be inherited from?
I don't have an exact problem which would call for such a class. To be
quite frank, I can not even think of a concrete example where this would be
an issue. I'm just curious.
Gianni said:Well kinda using virtual inheritance.
class Steralizer
{
friend class Sterile;
Steralizer() {} // private
};
class Sterile : Steralizer
{
...
};
Attempts to inherit from Sterile will result in access errors to
Steralizer's constructor.
I have not figured out a way to make Steralizer a template so you can
write:
class A : Steralizer<A>
{
...
};
IIRC there is a prob with defining a class as a friend in a template.
Gianni said:Well kinda using virtual inheritance.
class Steralizer
{
friend class Sterile;
Steralizer() {} // private
};
class Sterile : Steralizer
Chris said:[...]
What the heck does that mean?
Chris Thomasson said:What the heck does that mean?
It's a song lyric. Just sing along.
[ "Take a walk on the wild side", I think. (?) ]
Chris said:[...]
What the heck does that mean?
Shuckey said:What hath BobR wrought:
It's a song lyric. Just sing along.
[ "Take a walk on the wild side", I think. (?) ]
Yes. So sorry if it offended anyone. :-( I apologize.
Shuckey said:Is it possible to define a sterile class in C++? That is, a class that
cannot be inherited from?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.