セクション 1. 章 2
single
Class Attributes
メニューを表示するにはスワイプしてください
Attributes are some variables inside the class that describe each object. Let’s demonstrate it with two classes – Rectangle and Student.
We can represent Rectangle by its height and width. Add these Attributes to the class definition:
1234class Rectangle{ height; width; }
If you need to describe student in some way, you can create class Student with attributes like, for example, name and university.
1234class Student{ name; university; }
タスク
スワイプしてコーディングを開始
Add more attributes to the class Student: age and gpa variables.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 2
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください