lua继承c++类

	local MyScrollView =class("MyScrollView",function ()
		local scrollview = cc.ScrollView:create()
        -- _minScale=scrollview._minScale
        -- _maxScale=scrollview._maxScale
        return scrollview
	end)
	function MyScrollView:create()      --自定义构造函数
	    local myScrollView = MyScrollView:new()
	    return myScrollView
    end
    function MyScrollView:create(size)
	    local myScrollView = MyScrollView:new()
	    myScrollView:initWithViewSize(size) 
	    return myScrollView
    end 
    function MyScrollView:create(size,minScale,maxScale)
	    local myScrollView = MyScrollView:new()
	    myScrollView:initWithViewSize(size) 

        myScrollView._minScale = minScale
        myScrollView._maxScale = maxScale
	    -- myScrollView:setMinScale(minScale)
        --    myScrollView:setMaxScale(maxScale)
	    return myScrollView
    end 
    function MyScrollView:setMinScale(scale)
    	-- getmetatable(self)._minScale=scale
        MyScrollView._minScale = scale
    end
    function MyScrollView:setMaxScale(scale)
        -- getmetatable(self)._maxScale=scale
        MyScrollView._maxScale = scale
    end
只能根据父类有的函数来实现类

lua继承c++类,布布扣,bubuko.com

lua继承c++类

上一篇:C++关键字:mutable、volatile、explicit以及__based(转载)


下一篇:VC++界面编程之--实现工具栏自定义皮肤