Classes
Classes are a grouping of functions and variables
Define class
You can create a class using the kalasi keyword
kalasi Munthu {}Methods
To add some behavior to the class you can create a method (same way you write a function)
kalasi Munthu {
ndondomeko ndiNdani() {
Khonso.lemba("Mariya Malizeni");
}
}Methods can also take arguments
kalasi Munthu {
ndondomeko yikaZaka(zaka) {
Khonso.lemba(zaka);
}
}Properties
To add properties in a class, create a new variable in the class scope
kalasi Munthu {
numbala zaka = 2;
}Create Object
After you define a class time to final use it, you can use a class by creating a new object
Munthu munthu = Munthu();You can now call methods on that class
munthu.ndiNdani();