Skip to content

Instantly share code, notes, and snippets.

@cbmgit
Created November 1, 2020 11:04
Show Gist options
  • Save cbmgit/427879cb07167d59fb70898e2d516d1d to your computer and use it in GitHub Desktop.
Save cbmgit/427879cb07167d59fb70898e2d516d1d to your computer and use it in GitHub Desktop.
Rect = {area = 0, length = 0, breadth = 0}
function Rect: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
function Rect:printRect ()
print("The calculated Area of Rect: ",self.area)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment