Skip to content

Instantly share code, notes, and snippets.

@AntonKueltz
Last active November 29, 2018 20:49
Show Gist options
  • Save AntonKueltz/fe5b1cea9e13c34994dc4b8429f87f1e to your computer and use it in GitHub Desktop.
Save AntonKueltz/fe5b1cea9e13c34994dc4b8429f87f1e to your computer and use it in GitHub Desktop.
// empty.h
class Empty {
// this class declares no members but still will implicitly have the
// below declared by the compiler (in the public scope)
/*
Empty(){...} // default constructor
Empty(const Empty& rhs){...} // copy constructor
~Empty(){...} // default destructor
Empty& operator=(const Empty& rhs){...} // copy assignment operator
*/
};
// main.cpp
int main(int argc, char * argv[]) {
// code below is legal and will compile as constructors and methods
// used are implicitly declared by compiler
Empty e1;
Empty e2(e1);
e1 = e2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment