Skip to content

class :class

function classpp.class(className: string): (classData: classData) -> class

Creates a new class with the given classData table.

Default Syntax

local Class = class "Class" {
    constructor = function(self)
        ...
    end,
    destructor = function(self)
        ...
    end,
    Public = {
        ...
    },
    Private = {
        ...
    },
    Protected = {
        ...
    },
    Friend = {
        ...
    }
}

Without Syntax Sugar

local Class = class("Class")({
    constructor = function(self)
        ...
    end,
    destructor = function(self)
        ...
    end,
    Public = {
        ...
    },
    Private = {
        ...
    },
    Protected = {
        ...
    },
    Friend = {
        ...
    }
})

Parameters

className: string An unique name for the class.
inheritedClasses: ...class The classes the created class will inherit from. (Optional)
classData: classData The classData table that contains the data such as access specifiers for the class.

Returns