Created
February 5, 2013 02:35
-
-
Save enile8/4711669 to your computer and use it in GitHub Desktop.
A (crude) C++ example of using a class within a class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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