Last active
March 30, 2018 11:30
-
-
Save byBretema/81ea5e2269c7babf40d299861e243fc3 to your computer and use it in GitHub Desktop.
A simple and maybe illustrative cpp example with a class and a main.
This file contains 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 <stdio.h> // <--- printf() | |
#include <string> | |
#include <vector> | |
// using namespace std; // <--- Never ! | |
/* EMOJI CLASS */ | |
class emoji | |
{ | |
public: | |
// Una lista de cadenas de texto. | |
std::vector<std::string> faces; | |
// Constructor de la clase emoji. | |
emoji() | |
{ | |
faces.push_back(":)"); | |
faces.push_back("^^"); | |
faces.push_back("=P"); | |
faces.push_back("\\*.*/"); | |
} | |
}; // <-- SemiColon at the end of the class | |
/* ENTRYPOINT */ | |
int main() { | |
// Create emoji object. | |
auto em = emoji(); | |
// Iter over face list. | |
for (auto face : em.faces) { | |
printf(" %s \n", face.c_str()); | |
} | |
// All ok | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment