<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>naosim</author_name>
  <author_url>https://blog.hatena.ne.jp/naosim/</author_url>
  <blog_title>なおしむ論</blog_title>
  <blog_url>https://naosim.hatenablog.jp/</blog_url>
  <categories>
    <anon>javascript</anon>
  </categories>
  <description>jsのクラスはこんな感じで書きます class Position { constructor(x, y) { this.x = x; this.y = y; } getX() { return this.x; } getY() { return this.y; } getDistance() { return Math.sqrt(this.x * this.x + this.y * this.y); } } この書き方の辛いところ フィールドをprivateにできないからxとyが外から丸見え。セッター呼び放題 フィールドが増えるたびにthis.v = v;をコンストラクタに書く必要がある それ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnaosim.hatenablog.jp%2Fentry%2F2018%2F05%2F21%2F065449&quot; title=&quot;jsのクラスってコンストラクタに全部書いた方がよくね？ - なおしむ論&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-05-21 06:54:49</published>
  <title>jsのクラスってコンストラクタに全部書いた方がよくね？</title>
  <type>rich</type>
  <url>https://naosim.hatenablog.jp/entry/2018/05/21/065449</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
