일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- DART
- 연습문제
- 日本語
- springboot
- 일본어
- 건담
- nico
- rails
- html
- 一日一つメソッド
- java
- vscode
- jsp
- 반다이몰
- 인프런
- C로 시작하는 컴퓨터 프로그래밍4판
- 디지몬
- 単語
- Python
- ruby
- javascript
- 비즈니스일본어
- 건담베이스
- Flutter
- Spring
- rails7
- メソッド
- Web
- CSS
- 자바
Archives
- Today
- Total
목록クラスの継承 (1)
AR삽질러
Ruby クラスと定数(Constant)、クラスの継承
Ruby クラスと定数(Constant)、クラスの継承 1. クラスと定数(Constant) - Rubyでは、定数(Constant)は大文字で始まる名前の変数で、 これらは変更可能ですが、変更を推奨していません。 定数を変更すると、Rubyは警告を発生させます。 class Car REGION = 'USA' @@count = 0 def initialize(name) @name = name @@count += 1 end def hello puts "Hello, I am #{@name}. #{@@count} instance(s)" end def self.info puts "#{@@count} instance(s). Region: #{REGION}" end end car1 = Car.new('ar') car1.hello car2 ..
Ruby/Ruby-日本語
2023. 12. 19. 14:36