import ballerina/io; class Dog { string name; // field // Initializes a Dog instance passing it a name // which is stored in the 'name' field. function init(string name) { self.name = name; } // Function to make a noise. function makeNoise() { io:println("Woof!"); } } public function main() { // Create a new Dog instance and assign a reference to it // to the variable b. Dog d = new Dog("Rover"); // Print the dog's name. io:println("The dog is called ", d.name); // Make a noise. d.makeNoise(); }