ASP常用函数表
ASP常用函数表(新手们的好工具)
作者:未知
Array()
函数返回一个数组
表达式 Array(list)
允许数据类型: 字符,数字均可
实例: <%
Dim myArray()
For i = 1 to 7
Redim Preserve myArray(i)
myArray(i) = WeekdayName(i)
Next
%>
返回结果: 建立了一个包含7个元素的数组myArray
myArray("Sunday","Monday", ... ... "Saturday")
CInt()
函数将一个表达式转化为数字类型
表达式 CInt(expression)
允许数据类型: 任何有效的字符均可(不大于32767)
实例: <%
f = "234"
response.write cINT(f) + 2
%>
返回结果: 236
转化字符"234"为数字"234",如果字符串为空,则返回0值 CreateObject()
函数建立和返回一个已注册的ACTIVEX组件的实例。
表达式 CreateObject(objName)
允许数据类型: objName 是任何一个有效、已注册的ACTIVEX组件的名字.
实例: <%
Set con = Server.CreateObject("ADODB.Connection")
%> CStr()
函数转化一个表达式为字符串.
表达式 CStr(expression)
允许数据类型: expression 是任何有效的表达式。
实例: <%
s = 3 + 2
response.write "The 返回结果 is: " & cStr(s)
%>
返回结果: 转化数字“5”为字符“5”。 Date()
函数返回当前系统日期.
表达式 Date()
允许数据类型: None.
实例: <%=Date%>
返回结果: 9/9/00 DateAdd()
函数返回一个被改变了的日期。
表达式 DateAdd(timeinterval,number,date)
允许数据类型:
timeinterval is the time interval to add;
number is amount of time intervals to add;
and date is the starting date.
实例: <%
currentDate = #9/9/00#
newDate = DateAdd("m",3,currentDate)
response.write newDate
%>
<%
currentDate = #12:34:45 PM#
newDate = DateAdd("h",3,currentDate)
response.write newDate
%>
返回结果: 9/9/00
3:34:45 PM
"m" = "month";
"d" = "day";
If currentDate is in time format then,
"h" = "hour";
"s" = "second"; DateDiff()
函数返回两个日期之间的差值 。
表达式 DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear]])
允许数据类型: timeinterval 表示相隔时间的类型,如“M“表示“月”。
实例: <%
fromDate = #9/9/00#
toDate = #1/1/2000#
response.write "There are " & _
DateDiff("d",fromDate,toDate) & _
" days to millenium from 9/9/00."
%>
返回结果: 从9/9/00 到2000年还有 150 天. Day()
函数返回一个月的第几日 .
表达式 Day(date)
允许数据类型: date 是任何有效的日期。
实例: <%=Day(#9/9/00#)%>
返回结果: 9 formatCurrency()
函数返回表达式,此表达式已被格式化为货币值
表达式 formatCurrency(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
允许数据类型: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置; LeadingDigit 三态常数,指示是否显示小数值小数点前面的零。
实例: <%=formatCurrency(34.3456)%>
返回结果: $34.35 formatDateTime()
函数返回表达式,此表达式已被格式化为日期或时间
表达式 formatDateTime(Date, [, Namedformat])
允许数据类型: Namedformat 指示所使用的日期/时间格式的数值,如果省略,则使用 vbGeneralDate.
实例: <%=formatDateTime("09/9/00", vbLongDate)%>
返回结果: Sunday, September 09, 2000 formatNumber()
函数返回表达式,此表达式已被格式化为数值.
表达式 formatNumber(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
允许数据类型: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; LeadingDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; Paren 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; GroupDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。.
实例: <%=formatNumber(45.324567, 3)%>
返回结果: 45.325 formatPercent()
函数返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 (%)
表达式 formatPercent(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
允许数据类型: 同上.
实例: <%=formatPercent(0.45267, 3)%>
返回结果: 45.267% Hour()
函数以24时返回小时数.
表达式 Hour(time)
允许数据类型:
实例: <%=Hour(#4:45:34 PM#)%>
返回结果: 16
(Hour has been converted to 24-hour system) Instr()
函数返回字符或字符串在另一个字符串中第一次出现的位置.
表达式 Instr([start, ] strToBeSearched, strSearchFor [, compare])
允许数据类型: Start为搜索的起始值,strToBeSearched接受搜索的字符串 strSearchFor要搜索的字符.compare比较方式(详细见ASP常数)
实例: <%
strText = "This is a test!!"
pos = Instr(strText, "a")
response.write pos
%>
返回结果: 9 InstrRev()
函数同上,只是从字符串的最后一个搜索起
表达式 InstrRev([start, ] strToBeSearched, strSearchFor [, compare])
允许数据类型: 同上.
实例: <%
strText = "This is a test!!"
pos = InstrRev(strText, "s")
response.write pos
%>
返回结果: 13 Int()
函数返回数值类型,不四舍五入。
表达式 Int(number)
允许数据类型:
实例: <%=INT(32.89)%>
返回结果: 32 IsArray()
函数判断一对象是否为数组,返回布尔值 .
表达式 IsArray(name)
实例: <%
strTest = "Test!"
response.write IsArray(strTest)
%>
返回结果: False IsDate()
函数判断一对象是否为日期,返回布尔值
表达式 IsDate(expression)
实例: <%
strTest = "9/4/2000"
response.write IsDate(strTest)
%>
返回结果: True IsEmpty()
函数判断一对象是否初始化,返回布尔值.
表达式 IsEmpty(expression)
实例: <%
Dim i
response.write IsEmpty(i)
%>
返回结果: True IsNull()
函数判断一对象是否为空,返回布尔值.
表达式 IsNull(expression)
实例: <%
Dim i
response.write IsNull(i)
%>
返回结果: False IsNumeric()
函数判断一对象是否为数字,返回布尔值.
表达式 IsNumeric(expression)
实例: <%
i = "345"
response.write IsNumeric(i)
%>
返回结果: True
就算数字加了引号,ASP还是认为它是数字。 IsObject()
函数判断一对象是否为对象,返回布尔值.
表达式 IsObject(expression)
实例: <%
Set con = Server.CreateObject("ADODB.Connection")
response.write IsObject(con)
%>
返回结果: True LBound()
函数返回指定数组维的最小可用下标.
表达式 Lbound(arrayname [, dimension])
实例: <%
i = Array("Monday","Tuesday","Wednesday")
response.write LBound(i)
%>
返回结果: 0 LCase()
函数 返回字符串的小写形式
表达式 Lcase(string)
实例: <%
strTest = "This is a test!"
response.write LCase(strTest)
%>
返回结果: this is a test! Left()
函数返回字符串左边第length个字符以前的字符(含第length个字符).
表达式 Left(string, length)
实例: <%
strTest = "This is a test!"
response.write Left(strTest, 3)
%>
返回结果: Thi Len()
函数返回字符串的长度.
表达式 Len(string | varName)
实例: <%
strTest = "This is a test!"
response.write Len(strTest)
%>
返回结果: 15 LTrim()
函数去掉字符串左边的空格.
表达式 LTrim(string)
实例: <%
strTest = " This is a test!"
response.write LTrim(strTest)
%>
返回结果: This is a test! Mid()
函数返回特定长度的字符串(从start开始,长度为length).
表达式 Mid(string, start [, length])
实例: <%
strTest = "This is a test! Today is Monday."
response.write Mid(strTest, 17, 5)
%>
返回结果: Today Minute()
函数返回时间的分钟.
表达式 Minute(time)
实例: <%=Minute(#12:45:32 PM#)%>
返回结果: 45 Month()
函数返回日期.
表达式 Month(date)
实例: <%=Month(#08/04/99#)%>
返回结果: 8 MonthName()
函数返回指定月份
表达式 MonthName(month, [, Abb])
实例: <%=MonthName(Month(#08/04/99#))%>
返回结果: August Now()
函数返回系统时间
表达式 Now()
实例: <%=Now%>
返回结果: 9/9/00 9:30:16 AM Right()
函数返回字符串右边第length个字符以前的字符(含第length个字符).
表达式 Right(string, length)
实例: <%
strTest = "This is an test!"
response.write Right(strTest, 3)
%>
返回结果: st! Rnd()
函数产生一个随机数.
表达式 Rnd [ (number) ]
实例: <%
Randomize()
response.write RND()
%>
返回结果: 任何一个在0 到 1 之间的数 Round()
函数返回按指定位数进行四舍五入的数值.
表达式 Round(expression [, numRight])
实例: <%
i = 32.45678
response.write Round(i)
%>
返回结果: 32 Rtrim()
函数去掉字符串右边的字符串.
表达式 Rtrim(string)
实例: <%
strTest = "This is a test!! "
response.write RTrim(strTest)
%>
返回结果: This is a test!! Split()
函数将一个字符串分割并返回分割结果
表达式 Split (S[,d])
实例:<%V= Split(A,B,C)
For i = 0 To UBound(V)
Response.Write V(i)
Next
%>
返回结果: A B C Second()
函数返回秒.
表达式 Second(time)
实例: <%=Second(#12:34:28 PM#)%>
返回结果: 28 StrReverse()
函数反排一字符串
表达式 StrReverse(string)
实例: <%
strTest = "This is a test!!"
response.write StrReverse(strTest)
%>
返回结果: !!tset a si sihT Time()
函数返回系统时间.
表达式 Time()
实例: <%=Time%>
返回结果: 9:58:28 AM Trim()
函数去掉字符串左右的空格.
表达式 Trim(string)
实例: <%
strTest = " This is a test!! "
response.write Trim(strTest)
%>
返回结果: This is a test!! UBound()
函数返回指定数组维数的最大可用下标>.
表达式 Ubound(arrayname [, dimension])
实例: <%
i = Array("Monday","Tuesday","Wednesday")
response.write UBound(i)
%>
返回结果: 2 UCase()
函数返回字符串的大写形式.
表达式 UCase(string)
允许数据类型:
实例: <%
strTest = "This is a test!!"
response.write UCase(strTest)
%>
返回结果: THIS IS A TEST!! VarType()
函数返回指示变量子类型的值
表达式 VarType(varName)
实例: <%
i = 3
response.write varType(i)
%>
返回结果: 2(数字)详见"asp常数" WeekDay()
函数返回在一周的第几天.
表达式 WeekDay(date [, firstdayofweek])
实例: <%
d = #9/9/00#
response.write Weekday(d)
%>
返回结果: 4(星期三) WeekDayName()
函数返回一周第几天的名字.
表达式 WeekDayName(weekday [, Abb [, firstdayofweek]])
实例: <%
d = #9/9/00#
response.write WeekdayName(Weekday(d))
%>
返回结果: Wednesday Year()
函数返回当前的年份.
表达式 Year(date)
实例: <%=Year(#9/9/00#)%>
返回结果: 1999 程序定制QQ:70632246 ,广告联系QQ:7598454 网站制作服务 成功案例 版权声明 站长信箱
VIP源码
网友投搞
在线投诉
广告服务 首页 | 源码下载 | 网站开发 | 开发工具 | 网络安全 | 服务器 | 建站学堂 | 网页模板 | 教程下载 | 图片素材库 | 源码市场 | 建站论坛
您的位置:首页 - 网站开发 - ASP - 阅读文章 网站开发服务器网络安全开发工具源码下载源码求购源码出售
ASP常用函数表(新手们的好工具)
作者:未知
Array()
函数返回一个数组
表达式 Array(list)
允许数据类型: 字符,数字均可
实例: <%
Dim myArray()
For i = 1 to 7
Redim Preserve myArray(i)
myArray(i) = WeekdayName(i)
Next
%>
返回结果: 建立了一个包含7个元素的数组myArray
myArray("Sunday","Monday", ... ... "Saturday")
CInt()
函数将一个表达式转化为数字类型
表达式 CInt(expression)
允许数据类型: 任何有效的字符均可(不大于32767)
实例: <%
f = "234"
response.write cINT(f) + 2
%>
返回结果: 236
转化字符"234"为数字"234",如果字符串为空,则返回0值 CreateObject()
函数建立和返回一个已注册的ACTIVEX组件的实例。
表达式 CreateObject(objName)
允许数据类型: objName 是任何一个有效、已注册的ACTIVEX组件的名字.
实例: <%
Set con = Server.CreateObject("ADODB.Connection")
%> CStr()
函数转化一个表达式为字符串.
表达式 CStr(expression)
允许数据类型: expression 是任何有效的表达式。
实例: <%
s = 3 + 2
response.write "The 返回结果 is: " & cStr(s)
%>
返回结果: 转化数字“5”为字符“5”。 Date()
函数返回当前系统日期.
表达式 Date()
允许数据类型: None.
实例: <%=Date%>
返回结果: 9/9/00 DateAdd()
函数返回一个被改变了的日期。
表达式 DateAdd(timeinterval,number,date)
允许数据类型:
timeinterval is the time interval to add;
number is amount of time intervals to add;
and date is the starting date.
实例: <%
currentDate = #9/9/00#
newDate = DateAdd("m",3,currentDate)
response.write newDate
%>
<%
currentDate = #12:34:45 PM#
newDate = DateAdd("h",3,currentDate)
response.write newDate
%>
返回结果: 9/9/00
3:34:45 PM
"m" = "month";
"d" = "day";
If currentDate is in time format then,
"h" = "hour";
"s" = "second"; DateDiff()
函数返回两个日期之间的差值 。
表达式 DateDiff(timeinterval,date1,date2 [, firstdayofweek [, firstweekofyear]])
允许数据类型: timeinterval 表示相隔时间的类型,如“M“表示“月”。
实例: <%
fromDate = #9/9/00#
toDate = #1/1/2000#
response.write "There are " & _
DateDiff("d",fromDate,toDate) & _
" days to millenium from 9/9/00."
%>
返回结果: 从9/9/00 到2000年还有 150 天. Day()
函数返回一个月的第几日 .
表达式 Day(date)
允许数据类型: date 是任何有效的日期。
实例: <%=Day(#9/9/00#)%>
返回结果: 9 formatCurrency()
函数返回表达式,此表达式已被格式化为货币值
表达式 formatCurrency(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
允许数据类型: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置; LeadingDigit 三态常数,指示是否显示小数值小数点前面的零。
实例: <%=formatCurrency(34.3456)%>
返回结果: $34.35 formatDateTime()
函数返回表达式,此表达式已被格式化为日期或时间
表达式 formatDateTime(Date, [, Namedformat])
允许数据类型: Namedformat 指示所使用的日期/时间格式的数值,如果省略,则使用 vbGeneralDate.
实例: <%=formatDateTime("09/9/00", vbLongDate)%>
返回结果: Sunday, September 09, 2000 formatNumber()
函数返回表达式,此表达式已被格式化为数值.
表达式 formatNumber(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
允许数据类型: Digit 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; LeadingDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; Paren 指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。; GroupDigit i指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。.
实例: <%=formatNumber(45.324567, 3)%>
返回结果: 45.325 formatPercent()
函数返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 (%)
表达式 formatPercent(Expression [, Digit [, LeadingDigit [, Paren [, GroupDigit]]]])
允许数据类型: 同上.
实例: <%=formatPercent(0.45267, 3)%>
返回结果: 45.267% Hour()
函数以24时返回小时数.
表达式 Hour(time)
允许数据类型:
实例: <%=Hour(#4:45:34 PM#)%>
返回结果: 16
(Hour has been converted to 24-hour system) Instr()
函数返回字符或字符串在另一个字符串中第一次出现的位置.
表达式 Instr([start, ] strToBeSearched, strSearchFor [, compare])
允许数据类型: Start为搜索的起始值,strToBeSearched接受搜索的字符串 strSearchFor要搜索的字符.compare比较方式(详细见ASP常数)
实例: <%
strText = "This is a test!!"
pos = Instr(strText, "a")
response.write pos
%>
返回结果: 9 InstrRev()
函数同上,只是从字符串的最后一个搜索起
表达式 InstrRev([start, ] strToBeSearched, strSearchFor [, compare])
允许数据类型: 同上.
实例: <%
strText = "This is a test!!"
pos = InstrRev(strText, "s")
response.write pos
%>
返回结果: 13 Int()
函数返回数值类型,不四舍五入。
表达式 Int(number)
允许数据类型:
实例: <%=INT(32.89)%>
返回结果: 32 IsArray()
函数判断一对象是否为数组,返回布尔值 .
表达式 IsArray(name)
实例: <%
strTest = "Test!"
response.write IsArray(strTest)
%>
返回结果: False IsDate()
函数判断一对象是否为日期,返回布尔值
表达式 IsDate(expression)
实例: <%
strTest = "9/4/2000"
response.write IsDate(strTest)
%>
返回结果: True IsEmpty()
函数判断一对象是否初始化,返回布尔值.
表达式 IsEmpty(expression)
实例: <%
Dim i
response.write IsEmpty(i)
%>
返回结果: True IsNull()
函数判断一对象是否为空,返回布尔值.
表达式 IsNull(expression)
实例: <%
Dim i
response.write IsNull(i)
%>
返回结果: False IsNumeric()
函数判断一对象是否为数字,返回布尔值.
表达式 IsNumeric(expression)
实例: <%
i = "345"
response.write IsNumeric(i)
%>
返回结果: True
就算数字加了引号,ASP还是认为它是数字。 IsObject()
函数判断一对象是否为对象,返回布尔值.
表达式 IsObject(expression)
实例: <%
Set con = Server.CreateObject("ADODB.Connection")
response.write IsObject(con)
%>
返回结果: True LBound()
函数返回指定数组维的最小可用下标.
表达式 Lbound(arrayname [, dimension])
实例: <%
i = Array("Monday","Tuesday","Wednesday")
response.write LBound(i)
%>
返回结果: 0 LCase()
函数 返回字符串的小写形式
表达式 Lcase(string)
实例: <%
strTest = "This is a test!"
response.write LCase(strTest)
%>
返回结果: this is a test! Left()
函数返回字符串左边第length个字符以前的字符(含第length个字符).
表达式 Left(string, length)
实例: <%
strTest = "This is a test!"
response.write Left(strTest, 3)
%>
返回结果: Thi Len()
函数返回字符串的长度.
表达式 Len(string | varName)
实例: <%
strTest = "This is a test!"
response.write Len(strTest)
%>
返回结果: 15 LTrim()
函数去掉字符串左边的空格.
表达式 LTrim(string)
实例: <%
strTest = " This is a test!"
response.write LTrim(strTest)
%>
返回结果: This is a test! Mid()
函数返回特定长度的字符串(从start开始,长度为length).
表达式 Mid(string, start [, length])
实例: <%
strTest = "This is a test! Today is Monday."
response.write Mid(strTest, 17, 5)
%>
返回结果: Today Minute()
函数返回时间的分钟.
表达式 Minute(time)
实例: <%=Minute(#12:45:32 PM#)%>
返回结果: 45 Month()
函数返回日期.
表达式 Month(date)
实例: <%=Month(#08/04/99#)%>
返回结果: 8 MonthName()
函数返回指定月份
表达式 MonthName(month, [, Abb])
实例: <%=MonthName(Month(#08/04/99#))%>
返回结果: August Now()
函数返回系统时间
表达式 Now()
实例: <%=Now%>
返回结果: 9/9/00 9:30:16 AM Right()
函数返回字符串右边第length个字符以前的字符(含第length个字符).
表达式 Right(string, length)
实例: <%
strTest = "This is an test!"
response.write Right(strTest, 3)
%>
返回结果: st! Rnd()
函数产生一个随机数.
表达式 Rnd [ (number) ]
实例: <%
Randomize()
response.write RND()
%>
返回结果: 任何一个在0 到 1 之间的数 Round()
函数返回按指定位数进行四舍五入的数值.
表达式 Round(expression [, numRight])
实例: <%
i = 32.45678
response.write Round(i)
%>
返回结果: 32 Rtrim()
函数去掉字符串右边的字符串.
表达式 Rtrim(string)
实例: <%
strTest = "This is a test!! "
response.write RTrim(strTest)
%>
返回结果: This is a test!! Split()
函数将一个字符串分割并返回分割结果
表达式 Split (S[,d])
实例:<%V= Split(A,B,C)
For i = 0 To UBound(V)
Response.Write V(i)
Next
%>
返回结果: A B C Second()
函数返回秒.
表达式 Second(time)
实例: <%=Second(#12:34:28 PM#)%>
返回结果: 28 StrReverse()
函数反排一字符串
表达式 StrReverse(string)
实例: <%
strTest = "This is a test!!"
response.write StrReverse(strTest)
%>
返回结果: !!tset a si sihT Time()
函数返回系统时间.
表达式 Time()
实例: <%=Time%>
返回结果: 9:58:28 AM Trim()
函数去掉字符串左右的空格.
表达式 Trim(string)
实例: <%
strTest = " This is a test!! "
response.write Trim(strTest)
%>
返回结果: This is a test!! UBound()
函数返回指定数组维数的最大可用下标>.
表达式 Ubound(arrayname [, dimension])
实例: <%
i = Array("Monday","Tuesday","Wednesday")
response.write UBound(i)
%>
返回结果: 2 UCase()
函数返回字符串的大写形式.
表达式 UCase(string)
允许数据类型:
实例: <%
strTest = "This is a test!!"
response.write UCase(strTest)
%>
返回结果: THIS IS A TEST!! VarType()
函数返回指示变量子类型的值
表达式 VarType(varName)
实例: <%
i = 3
response.write varType(i)
%>
返回结果: 2(数字)详见"asp常数" WeekDay()
函数返回在一周的第几天.
表达式 WeekDay(date [, firstdayofweek])
实例: <%
d = #9/9/00#
response.write Weekday(d)
%>
返回结果: 4(星期三) WeekDayName()
函数返回一周第几天的名字.
表达式 WeekDayName(weekday [, Abb [, firstdayofweek]])
实例: <%
d = #9/9/00#
response.write WeekdayName(Weekday(d))
%>
返回结果: Wednesday Year()
函数返回当前的年份.
表达式 Year(date)
实例: <%=Year(#9/9/00#)%>
返回结果: 1999
ASP常用函数表的更多相关文章
- Makefile 常用函数表
Makefile 常用函数表 一.字符串处理函数1.$(subst FROM,TO,TEXT)函数名称:字符串替换函数—subst.函数功能:把字串“TEXT”中的“FROM”字符替换为“TO”.返 ...
- asp.net常用函数表
文章转载于[IT花园]:http://www.itgarden.com.cn/showtopic-29.aspx Abs(number) 取得数值的绝对值. Asc(String) 取得字符串表达式的 ...
- C++ 虚函数表解析
转载:陈皓 http://blog.csdn.net/haoel 前言 C++中 的虚函数的作用主要是实现了多态的机制.关于多态,简而言之就是用父类型别的指针指向其子类的实例,然后通过父类的指针调用实 ...
- C++ 多态、虚函数机制以及虚函数表
1.非virtual函数,调用规则取决于对象的显式类型.例如 A* a = new B(); a->display(); 调用的就是A类中定义的display().和对象本体是B无关系. 2. ...
- C++迟后联编和虚函数表
先看一个题目: class Base { public: virtual void Show(int x) { cout << "In Base class, int x = & ...
- C++ 知道虚函数表的存在
今天翻看陈皓大大的博客,直接找关于C++的东东,看到了虚函数表的内容,找一些能看得懂的地方记下笔记. 0 引子 类中存在虚函数,就会存在虚函数表,在vs2015的实现中,它存在于类的头部. 假设有如下 ...
- C++虚函数和虚函数表
前导 在上面的博文中描述了基类中存在虚函数时,基类和派生类中虚函数表的结构. 在派生类也定义了虚函数时,函数表又是怎样的结构呢? 先看下面的示例代码: #include <iostream> ...
- C++ Daily 《5》----虚函数表的共享问题
问题: 包含一个以上虚函数的 class B, 它所定义的 对象是否共用一个虚函数表? 分析: 由于含有虚函数,因此对象内存包含了一个指向虚函数表的指针,但是这个指针指向的是同一个虚函数表吗? 实验如 ...
- C++虚函数表
大家知道虚函数是通过一张虚函数表来实现的.在这个表中,主要是一个类的虚函数的地址表,这张表解决了继承.覆盖的问题,其内容真是反应实际的函数.这样,在有虚函数的类的实例中,这个表分配在了这个实例的内存中 ...
随机推荐
- HDU1856More is better(并查集)
最近发现以前的东西都忘得差不多了,在这里刷刷水题 并查集: int find_parent(int x) { return x = p[x] ? x : p[x] = find_parent(p[x] ...
- [html]html常用代码
上传文件表单属性 enctype="multipart/form-data" 单选(是否选中) checked="checked" 下拉列表(是否选中) sel ...
- MongoDB 快速入门--中级
索引 ensureIndex 用来创建索引,需要注意的就是一个集合最多也就64个索引 如果没加所有就是表扫表,速度很慢, 当然如果索引的键有多个,就必须考虑顺序 拓展索引 同样的也可以为内嵌文档 建立 ...
- 动态创建dom元素
效果图如上所示: 思维nav:就相当于qq空间发表动态(说说),在输入框里输入内容,点击提交(发表),内容就呈现在下面的动态栏里.我这里是准备写一个招聘的app,大家可以随便想象下哪些情况会遇到动态创 ...
- 如何克隆路由器MAC地址,怎么操作?
路由器的“MAC地址克隆”的意思是: 不克隆时,从外网访问你的电脑,获得的MAC地址是路由器的mac地址. 克隆后,从外网访问你的电脑,获得的MAC地址是你电脑网卡的mac地址. 实用举例如下: 中国 ...
- 解决 DCEF3 在 BeforePopup 事件中打开新窗体的问题
此问题的解决方案从 https://groups.google.com/forum/#!topic/delphichromiumembedded/xzshOr-pjnU 获得. procedure T ...
- C#的图片拼接
貌似很长时间没有写博客了,感觉再不写都要废了. 这段时间确实迷茫得不行,整天混混顿顿的,逃避这个逃避那个,话说已经辞职一个月了…… 这几天在学用libgdx做安卓上的游戏,感觉缺少一个图片拼接的工具, ...
- python selenium自动化(三)Chrome Webdriver的兼容
当一个自动化测试被实现在一个浏览器之后,我们会希望我们的测试能够覆盖到尽量多的别的浏览器.通过跨平台的测试来保证我们的程序在多个浏览器下都能正常工作. 在安装了selenium之后,firefox w ...
- android 多语言版本开发
最近项目中用用到语言切换功能,第一想到的就是资源文件,没错. 在资源文件中新建一个文件夹values-en,en表示英语,有一些还细化到地区,如values-en-rUS 即美国地区的英语,r是必需的 ...
- java spring 使用注解来实现缓存
这里举例使用spring3.1.4 + ehcache 注解的方式使用cache 是在spring3.1加入的 使用方法: 1.ehcache依赖+spring依赖 <!-- ehcache依赖 ...