Advertisement
Hiteshw11

Using A Default constructor in Dart

Nov 25th, 2024
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.24 KB | Source Code | 0 0
  1. void main() {
  2.  
  3. var r1 = Circle();
  4.   print(r1.radiusCheck());
  5. }
  6.  
  7. class Circle
  8. {
  9.  
  10. int radius=1;
  11.  
  12. /*Here there is no constructor mentioned so dart uses it's inbuilt default constructor */
  13.  
  14. int radiusCheck()
  15. {
  16. return radius;
  17. }
  18.  
  19. }
Tags: dart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement