-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOOP.dart
50 lines (32 loc) · 813 Bytes
/
OOP.dart
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// This is a practice for OOP concepts
// declaring a class
// Create a class Book with three properties: name, author, and price. Also, create a method called display, which prints out the values of the three properties.
import 'dart:ffi';
class Book {
String? name;
String? author;
int? price;
void displayInfo (){
print("name: $name");
print("author: $author");
print("price: $price");
}
}
class Rectangle {
double? width;
double? height;
double area (){
return (height! * width!);
}
}
void main (){
// Book kumlsStep1 = Book();
// kumlsStep1.name = "KUMLS Step1";
// kumlsStep1.price = 0;
// kumlsStep1.author = "Mahmoud Mohamed Akasha";
// kumlsStep1.displayInfo();
Rectangle me = Rectangle();
me.height = 10.4;
me.width = 22.3;
print(me.area());
}