0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

c++の基本を備忘録的にまとめていく Part1(名前空間)

Last updated at Posted at 2019-02-15

最近無性にC++を使いたくなったが、もうほとんど忘れていたので、基本をまとめていきたい。

やったこと

名前空間について少しやった。

main.cpp
#include <iostream>

namespace Sub {
    void sub () {
         std::cout << "HELLO WORLD !!" << std::endl;
    }
}
sub.hpp
namespace Sub {
   void sub();
}
main.cpp
#include <iostream>
#include "sub.hpp"

int main () {
    sub::Sub();
    return 0;
}

=> 'HELLO WORLD !!'が出力される

みたいな感じ

ちょっと感想

Classを使う意味ってなんだろう?って昔から思う
小さいものとか構造体チックに使う時以外使う必要あるのかな?と思う

こんなコードあるよとか返信されると、とても喜びます

Part2 (Makefile) => https://qiita.com/komi9977/items/c1eb08f32adabc85158d

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?