Skip to content

Instantly share code, notes, and snippets.

@sim590
Last active March 3, 2021 21:51
Show Gist options
  • Save sim590/fa626243077e7b5c738384d25e446354 to your computer and use it in GitHub Desktop.
Save sim590/fa626243077e7b5c738384d25e446354 to your computer and use it in GitHub Desktop.
#include <iostream>
#include "doubledecl.h"
namespace mon_name_space {
int maVariable = 0;
DoubleDecl::DoubleDecl() {
maVariable = 1;
}
int DoubleDecl::get()
{
return maVariable;
}
} /* mon_name_space */
int main(int argc, char *argv[])
{
mon_name_space::DoubleDecl d;
std::cout << d.get() << std::endl;
std::cout << mon_name_space::maVariable << std::endl;
return 0;
}
/* vim: set sts=4 ts=4 sw=4 tw=120 et :*/
namespace mon_name_space {
class DoubleDecl {
public:
DoubleDecl ();
virtual ~DoubleDecl () {}
int get();
private:
int maVariable;
};
} /* mon_name_space */
/* vim: set sts=4 ts=4 sw=4 tw=120 et :*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment