Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Classes

Dhruvan edited this page Oct 20, 2022 · 3 revisions

This is how Classes works in Versace

Classes

  • Classes are written in the following format:
  • Classes are objects that can be used to create objects.
  • They work like a template for creating objects.
class (name) {
    (statements)
}
  • Example:
class Person {
    func say_hi() {
        out < "Hello, my name is Jhon" < red < tab
    }
    func say_bye() {
        out < "Goodbye" < green 
    }
}
  • To create the equivalent of the __init__ function in Python, you can use the repr function.
  • This function is called when the object is created. It is used to initialize the object.
  • Example:
class Person {
    func repr(self) {
        self.name = "Jhon"
        self.age = 20
    }
}
Clone this wiki locally