
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
【Ruby】クラスとインスタンスの概念を用いたコードの作成 - Qiita
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
【Ruby】クラスとインスタンスの概念を用いたコードの作成 - Qiita
class Article def initialize(author, title, content) @author = author @title = title @content = c... class Article def initialize(author, title, content) @author = author @title = title @content = content end def author @author end def title @title end def content @content end end article = Article.new("阿部", "Rubyの素晴らしさについて", "Awesome Ruby!") puts "著者: #{article.author}" puts "タイトル: #{article.title}" puts "本文: #{article.content}" 解説 (23行目)Article.newでインスタンスを生成し、変数articleに代入します。その際に、阿部、Rubyの素晴らしさに