Skip to content

Instantly share code, notes, and snippets.

@echristopherson
Created August 31, 2011 04:38
Show Gist options
  • Save echristopherson/1182834 to your computer and use it in GitHub Desktop.
Save echristopherson/1182834 to your computer and use it in GitHub Desktop.
#include <iostream>
class circle {
public:
void draw();
};
void circle::draw() {
std::cout << "\n";
std::cout << " ****\n";
std::cout << " * *\n";
std::cout << " * *\n";
std::cout << " * *\n";
std::cout << " * *\n";
std::cout << " * *\n";
std::cout << " ****\n";
std::cout << "\n";
}
namespace circle {
class inner_circle {
public:
void draw();
};
void inner_circle::draw() {
std::cout << "\n";
std::cout << " ****\n";
std::cout << " * *\n";
std::cout << " * ** *\n";
std::cout << " * * * *\n";
std::cout << " * ** *\n";
std::cout << " * *\n";
std::cout << " ****\n";
std::cout << "\n";
}
}
int main() {
// This won't work, because g++ doesn't know if it refers to the class or the namespace:
//circle a_circle;
class circle a_circle;
// I can't find a way to do this:
//circle::inner_circle an_inner_circle;
a_circle.draw();
//an_inner_circle.draw();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment