Class z Class ve VBS

Vývojová prostředí, aplikace, skripty, http://www... síťové programy, internet, sdílení...
Odpovědět
VasekB
Začátečník
Začátečník
Registrován: 12. bře 2005

Class z Class ve VBS

Příspěvek od VasekB »

potreboval bych udelat ve VBS tridu, ktera ale je z jine tridy. nevi nekdo jak na to, nejak na to nemuzu prijit

vytvoreni jedne tridy je OK:
Class A
Public cA
End Class

Set oA = New A
oA.cA = 1

ale ted potrebuju oB, ktery ma vlastnost ca z oA

Set oB = New B
ob.oA.cA = 2

jak k tomu dodelat tu tridu ?
Class B
neco jako Public cA = New A
End Class

zkousel jsem ruzne Let, Set, Get a nemuzu prijit na spravnou kombinaci
VasekB
Začátečník
Začátečník
Registrován: 12. bře 2005

Příspěvek od VasekB »

nasel jsem jak zdedit vlastnosti jine tridy.. musi se ale znova nadefinovat v nove tride, ale chovani prevezmou z dedene tridy
viz http://www.webdeveloper.com/forum/showt ... p?t=160517

Kód: Vybrat vše

Class A
	Public pA
End Class

Class B
	Public pB
	Private pBp
	Sub Class_Initialize 
		Set pBp = New A
	End Sub 

	Public Property Let pA(val)
		pBp.pA = val
	End Property

	Public Property Get pBB
		pBB = pBp.pA
	End Property

End Class


Set oA = New A
oA.pA = 1

Set oB = New B
oB.pB = 2
oB.pA = 3

Wscript.Echo oA.pA & "-" & oB.pB & "-" & oB.pBB
VasekB
Začátečník
Začátečník
Registrován: 12. bře 2005

Příspěvek od VasekB »

potrebuji prepast do VBS tohle:

Kód: Vybrat vše


	'/// <summary>
	'/// An LUID is a 64-bit value guaranteed to be unique only on the system on which it was generated. The uniqueness of a locally unique identifier (LUID) is guaranteed only until the system is restarted.
	'/// </summary>
	<StructLayout(LayoutKind.Sequential, Pack:=1)> _
	Friend Structure LUID
		'/// <summary>
		'/// The low order part of the 64 bit value.
		'/// </summary>
		Public LowPart As Integer
		'/// <summary>
		'/// The high order part of the 64 bit value.
		'/// </summary>
		Public HighPart As Integer
	End Structure
	'/// <summary>
	'/// The LUID_AND_ATTRIBUTES structure represents a locally unique identifier (LUID) and its attributes.
	'/// </summary>
	<StructLayout(LayoutKind.Sequential, Pack:=1)> _
	Friend Structure LUID_AND_ATTRIBUTES
		'/// <summary>
		'/// Specifies an LUID value.
		'/// </summary>
		Public pLuid As LUID
		'/// <summary>
		'/// Specifies attributes of the LUID. This value contains up to 32 one-bit flags. Its meaning is dependent on the definition and use of the LUID.
		'/// </summary>
		Public Attributes As Integer
	End Structure
	'/// <summary>
	'/// The TOKEN_PRIVILEGES structure contains information about a set of privileges for an access token.
	'/// </summary>
	<StructLayout(LayoutKind.Sequential, Pack:=1)> _
	Friend Structure TOKEN_PRIVILEGES
		'/// <summary>
		'/// Specifies the number of entries in the Privileges array.
		'/// </summary>
		Public PrivilegeCount As Integer
		'/// <summary>
		'/// Specifies an array of LUID_AND_ATTRIBUTES structures. Each structure contains the LUID and attributes of a privilege.
		'/// </summary>
		Public Privileges As LUID_AND_ATTRIBUTES
	End Structure

Odpovědět

Zpět na „Programování a web“