What is class in DART language

This article gives description about dart class
  • 2471

Classes in Dart

Classes are fundamental building block of a program. Dart is object oriented programming language with class and single inheritance and it's root class  is object class. class contains constructors, instance member and static member.

Dart class have following characteristic-

  • Dart's class have single inheritance
  • Dart's class have constructors
  • Dart's class have methods like ( getters, setters)
  • Dart's class have static methods.

Syntax of dart class

class NameOfClass{//************Body************ //}

Example of dart class

class Welcome{

  CallMe(){

    print("Welcome in Dart Class!");

  }

}

 

void main() {

  Welcome obj = new Welcome();  //Object Creation

  obj.CallMe();
}


Output:

dartclass.png

Ask Your Question 

Got a programming related question? You may want to post your question here
 
© 2020 DotNetHeaven. All rights reserved.