Skip to content

Instantly share code, notes, and snippets.

@fresky
Created December 4, 2012 15:56
Show Gist options
  • Save fresky/4205430 to your computer and use it in GitHub Desktop.
Save fresky/4205430 to your computer and use it in GitHub Desktop.
How to make a class non derivable in C++
class NoDerive {
NoDerive(){};
public:
static NoDerive GetNoDerive(){ return NoDerive();};
~NoDerive(){};
};
class NoDerive;
class NoDeriveBase
{
friend class NoDerive;
NoDeriveBase(){};
};
class NoDerive:private virtual NoDeriveBase {
public:
NoDerive(){};
~NoDerive(){};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment