Functions Simple

 void main()

{
print("Hello World");

var myC = myClass();

print(myC.Add(5,6));

print(myC.Add(200, 300));

/*myC.printName("Wscube Tech");
//
//
//
myC.printName("Flutter");
//
//
//
myC.printName("Ramanujan");
//
//
//
myC.printName("How are you ?");*/

}

class myClass
{
myClass() // Default Constructor
{ // Init Block of the Class
print("myClass Object Created!");
}

void printName(String name) // Declaration
{
print(name); // Definition
}

int Add(int no1, int no2)
{
int sum = no1 + no2;
return sum;
}
}

/// OUTPUT:
/// Hello World
/// myClass Object Created!
/// 11
/// 500

Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter