Skip to content

Instantly share code, notes, and snippets.

@byBretema
Last active March 30, 2018 11:30
Show Gist options
  • Save byBretema/81ea5e2269c7babf40d299861e243fc3 to your computer and use it in GitHub Desktop.
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.
#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