Skip to content

Instantly share code, notes, and snippets.

@enile8
Created February 5, 2013 02:35
Show Gist options
  • Select an option

  • Save enile8/4711669 to your computer and use it in GitHub Desktop.

Select an option

Save enile8/4711669 to your computer and use it in GitHub Desktop.
A (crude) C++ example of using a class within a class.
#include <iostream>
#include <string>
using namespace std;
class alpha
{
public:
static string alphaFunc()
{
return "Greetings from the alpha class.\n";
}
};
class beta
{
public:
void alphaBeta()
{
cout << alpha::alphaFunc();
}
};
int main()
{
beta b;
b.alphaBeta();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment