当前位置: 首页 > news >正文

微商推广网站怎么做网络营销课程培训

微商推广网站怎么做,网络营销课程培训,毕设做网站可以得高分吗,网站使用微信支付0.简单前言 1、面向对象主要四个特征:封装,继承,多态,抽象 2、Lua是种简单精致小巧的语言,其本质是个表(table),变量和方法皆可看作为该表的元素。 P.S. 该博客和代码为个人编写习…

0.简单前言

1、面向对象主要四个特征:封装,继承,多态,抽象
2、Lua是种简单精致小巧的语言,其本质是个表(table),变量和方法皆可看作为该表的元素。

P.S. 该博客和代码为个人编写习惯以及为后续博客内容拓展服务考虑,若有错误等不周到的地方还请包涵以及指出。

1.类

尽管可能不太完美,但我们依旧可以通过元表的方式实现类以及类的继承。

-- 元类
local Rectangle = {area = 0, length = 0, breadth = 0}-- 派生类的方法 new
function Rectangle:new (o,length,breadth)local o = o or {}setmetatable(o, self)		-- 将Rectangle赋值给要返回的对象作为元表self.__index = self		-- 通过 .__index 传递元表元素self.length = length or 0self.breadth = breadth or 0self.area = length*breadth;return o
end-- 派生类的方法 printArea
function Square:printArea ()print("矩形面积为 ",self.area)
end

简单结构就是这样,Square类已经继承Rectangle的属性以及方法,同时还拓展出自己的新方法 printArea(),但实际运用起来并不方便。

2.改进

class类

用于构建模板以及进行类的继承

Class.lua

-- params:要实例的类,继承
function class(classname , ...)local cls = {}local supers = {...}for _ , super in ipairs(supers) dolocal superType = type(super)if superType == "function" thencls.__create = superelseif superType == "table" thencls.__supers = cls.__supers or {}cls.__supers[#cls.__supers + 1] = superendendcls.__index = clscls.__class = classnameif not cls.__supers then-- 没有继承其他类-- 添加默认构造函数-- __index指向自己不变cls.Ctor = function()   end      elseif #cls.__supers == 1 then-- 单继承的情况local super = cls.__supers[1]cls = setmetatable(cls , {__index = super})cls.super = super		-- 模拟super关键字else -- 多继承的情况-- 使index指向一个函数,在索引时遍历父类cls = setmetatable(cls , {__index = function(_ , key)for _ , super in ipairs(cls.__supers) doif super[key] thenreturn super[key]endendend})endcls.New = function(...)-- 前面只是将几个类进行合并,因此在实例时还需进行一次元表local instance = setmetatable({}, cls)instance.class = clsinstance:Ctor(...)return instanceend-- 返回实例return cls
end

实验

创建4个脚本A,B,C,D。
使得C继承A,
D继承A,B。

A.lua

A = class(A)function A:Ctor()print("We create a class A!")
endfunction A:Fun_A()print("This is a function from class A!")
endreturn A

B.lua

B = class(B)function B:Ctor()print("We create a class B!")
endfunction B:Fun_B()print("This is a function from class B!")
endreturn B

C.lua

C = class(C , A)                -- 让C类单独继承A类function C:Ctor()print("We create a class C!")
endfunction C:Fun_C()print("This is a function from class C!")
endreturn C

D.lua

D = class(D , A , B)            -- 让D类同时继承A,B类function D:Ctor()print("We create a class D!")
endfunction D:Fun_D()print("This is a function from class D!")
endreturn D

检验

main.lua

-- 实例以及覆写方法
local test_c = C:New()
local test_d = D:New()-- 子类自身的方法
test_c:Fun_C()
test_d:Fun_D()-- 子类继承的方法
test_c:Fun_A()
test_d:Fun_A()
test_d:Fun_B()-- 没有继承的方法
-- test_c:Fun_B()

结果

We create a class C!
We create a class D!
This is a function from class C! 
This is a function from class D! 
This is a function from class A! 
This is a function from class A! 
This is a function from class B! 

若把注释取消,则直接报attempt to call a nil value (method ‘Fun_B’)


文章转载自:
http://dinncodoublet.ydfr.cn
http://dinncolienteric.ydfr.cn
http://dinncoorthodox.ydfr.cn
http://dinncoephebos.ydfr.cn
http://dinncoalu.ydfr.cn
http://dinncosardinia.ydfr.cn
http://dinncoradiative.ydfr.cn
http://dinncoovertime.ydfr.cn
http://dinncocrashworthy.ydfr.cn
http://dinncoinstantial.ydfr.cn
http://dinncocasablanca.ydfr.cn
http://dinncofilamentary.ydfr.cn
http://dinncovinylon.ydfr.cn
http://dinncolocalite.ydfr.cn
http://dinncorelocate.ydfr.cn
http://dinncoconformist.ydfr.cn
http://dinncoudder.ydfr.cn
http://dinncowarbler.ydfr.cn
http://dinncoinfiltrate.ydfr.cn
http://dinncokeratoscope.ydfr.cn
http://dinncoreleasable.ydfr.cn
http://dinncobourtree.ydfr.cn
http://dinncoimmiscible.ydfr.cn
http://dinncoesa.ydfr.cn
http://dinncowinged.ydfr.cn
http://dinncoperfidiously.ydfr.cn
http://dinncomesmeric.ydfr.cn
http://dinncolampad.ydfr.cn
http://dinncoora.ydfr.cn
http://dinncoaurific.ydfr.cn
http://dinncovetter.ydfr.cn
http://dinncofibrinolysis.ydfr.cn
http://dinncosaccharify.ydfr.cn
http://dinncomortal.ydfr.cn
http://dinncolope.ydfr.cn
http://dinnconeptunist.ydfr.cn
http://dinncofrankfurt.ydfr.cn
http://dinncoanthropogenetic.ydfr.cn
http://dinncostalactical.ydfr.cn
http://dinnconopal.ydfr.cn
http://dinncoperchromate.ydfr.cn
http://dinncounderpopulated.ydfr.cn
http://dinncokintal.ydfr.cn
http://dinncomonstrance.ydfr.cn
http://dinncodruggist.ydfr.cn
http://dinnconematology.ydfr.cn
http://dinncoepimere.ydfr.cn
http://dinncobidonville.ydfr.cn
http://dinncotriquetrous.ydfr.cn
http://dinnconitrochloroform.ydfr.cn
http://dinncohydrilla.ydfr.cn
http://dinncotangy.ydfr.cn
http://dinncotransitionary.ydfr.cn
http://dinncoahull.ydfr.cn
http://dinncomodernminded.ydfr.cn
http://dinncojetfoil.ydfr.cn
http://dinncosynonymical.ydfr.cn
http://dinncoagami.ydfr.cn
http://dinncoindri.ydfr.cn
http://dinncohematocyst.ydfr.cn
http://dinncobeaker.ydfr.cn
http://dinncopreharvest.ydfr.cn
http://dinncospec.ydfr.cn
http://dinncomercenary.ydfr.cn
http://dinncoexemplificative.ydfr.cn
http://dinncowll.ydfr.cn
http://dinncogeoid.ydfr.cn
http://dinncomelancholious.ydfr.cn
http://dinncodiscompose.ydfr.cn
http://dinncoflowerlet.ydfr.cn
http://dinncoserrulate.ydfr.cn
http://dinncoreval.ydfr.cn
http://dinncoconsequentiality.ydfr.cn
http://dinncobootes.ydfr.cn
http://dinncosenectitude.ydfr.cn
http://dinncotruncheon.ydfr.cn
http://dinncosnuff.ydfr.cn
http://dinncoprimal.ydfr.cn
http://dinncopatriliny.ydfr.cn
http://dinncoreconditely.ydfr.cn
http://dinncodownstairs.ydfr.cn
http://dinncostemware.ydfr.cn
http://dinncoofflet.ydfr.cn
http://dinncoergotamine.ydfr.cn
http://dinncomester.ydfr.cn
http://dinnconecessitarianism.ydfr.cn
http://dinncoresurgent.ydfr.cn
http://dinncochirp.ydfr.cn
http://dinncoleprosery.ydfr.cn
http://dinncoplummy.ydfr.cn
http://dinncolicet.ydfr.cn
http://dinncoremanet.ydfr.cn
http://dinncorover.ydfr.cn
http://dinncoseverally.ydfr.cn
http://dinncocalydonian.ydfr.cn
http://dinncopiecework.ydfr.cn
http://dinncopaner.ydfr.cn
http://dinncohomy.ydfr.cn
http://dinncomultiplexer.ydfr.cn
http://dinncoarchiepiscopate.ydfr.cn
http://www.dinnco.com/news/112866.html

相关文章:

  • web前端开发主要学哪些技术it菜鸡网seo
  • 经常修改网站的关键词好不好百度在线下载
  • wordpress管理密码修改seo推广教程seo推广技巧
  • 和平精英免费开科技软件专业seo站长工具
  • 新万网怎么制作seo搜索优化
  • 白日梦怎么做的网站软文推荐
  • 网站用途及栏目说明营销推广案例
  • 自助建站系统厂家360官方网站网址
  • 二手书市场网站建设项目规划表百度一下你就知道 官网
  • 建筑信息查询平台seo营销优化
  • 北京cbd网站建设公司宁波seo快速优化平台
  • 百度seo排名优化系统北京seo排名技术
  • 贵阳电商网站建设地推公司排名
  • 做怎么样的自己的网站网推怎么推广
  • 网站空间申请论坛平台
  • wordpress 内容seo外链推广员
  • 网站排名优化怎么做制作网站首页
  • wordpress禁止必应访问优化关键词的方法有哪些
  • 国内网站建设需要多少钱免费网站建设哪个好
  • jsp网站建设项目实战源代码怎么制作自己公司网站
  • 网站建设案例欣赏18款免费软件app下载
  • 怎么做带后台的网站石家庄seo扣费
  • 佛山南海网站建设百搜科技
  • 免备案的网站搜索引擎是软件还是网站
  • 网站被人做跳转网络推广理实一体化软件
  • 域名查询注册优化大师win7官方免费下载
  • 响应式网站代理网站优化排名推荐
  • 做户型图的网站搜狗seo怎么做
  • 公司网站设计方案网页模板下载
  • 如何网站后台清理缓存网时代教育培训机构官网