@Corsaka/

WhisperedImpoliteChapter

C++11

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <string>
#include <vector> // (variable-width array)
#include <iostream>
#include <memory>
using namespace std;
// imports

class Pokemon {
public:
  string name;
  int sp_atk;
  int sp_def;
  int atk;
  int def;
};

shared_ptr<Pokemon> make_a_pikachu() {
  auto p = make_shared<Pokemon>();

  p->name = "Pikachu";

  return p;
}

int main() {
  auto pikachu = make_a_pikachu();
  vector<shared_ptr<Pokemon>> pokes = { pikachu };

  pikachu->name = "notpika";

  cout << pokes[0] << endl;

  return 0;
}