-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
void main() { | ||
//static method calling from class itself | ||
Student.getResults(); | ||
|
||
//named constructor with marksdetails as name | ||
Student s = new Student(name: "Atish", roll: 2); | ||
|
||
Student std = new Student.classname([1, 2, 3, 4]); | ||
std.showclass(); | ||
} | ||
|
||
class Student { | ||
//properties | ||
late int roll; | ||
late String name; | ||
late int classid; | ||
late bool isMale; | ||
List<int> marks = []; | ||
|
||
//constructor | ||
Student({this.roll = 1, this.name = "ram"}); | ||
|
||
Student.classname(this.marks); | ||
|
||
//methods which denotes the behaviours of the class objects. | ||
static void getResults() { | ||
print("i am static method"); | ||
} | ||
|
||
void showclass() { | ||
print("This is marks: ${this.marks}"); | ||
print("This is name: $name and roll.no: $roll"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters