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
Post a Comment