Module:Test1234

From Wiki Knowledge Base | Teltonika GPS
Revision as of 15:05, 29 November 2018 by Dziugas (talk | contribs)

-- Meta class
Rectangle = {area = 0, length = 0, breadth = 0}

-- Derived class method new

function Rectangle:new (o,length,breadth)
   o = o or {}
   setmetatable(o, self)
   self.__index = self
   self.length = length or 0
   self.breadth = breadth or 0
   self.area = length*breadth;
   return o
end

-- Derived class method printArea

function Rectangle:printArea ()
   return self.area
end