Revision history for KeyPgBase


Revision [21997]

Last edited on 2017-11-21 01:10:54 by JeffMarshall [fix page link name case]
Additions:
- ##[[KeyPgOptionbase|Option Base]]##
Deletions:
- ##[[KeyPgOptionBase|Option Base]]##


Revision [20058]

Edited on 2016-02-10 15:54:48 by DkLwikki [Update link format]
Additions:
Provides explicit access to base type members in non-static methods of a ##[[KeyPgType|Type]]##
##**Base**## provides a way to explicitly access members of a specific base type, in the context of non-static methods of a user-defined type derived from another type using ##[[KeyPgExtends|Extends]]##.
- Methods are only supported in the //[[CompilerOptlang|-lang fb]]// dialect, hence ##**Base**## has no function in other dialects.
- ##[[KeyPgBaseInit|Base (initializer)]]##
- ##[[KeyPgThis|This]]##
- ##[[KeyPgType|Type]]##
- ##[[KeyPgExtends|Extends]]##
- ##[[KeyPgOptionBase|Option Base]]##
Deletions:
Provides explicit access to base type members in non-static methods of a ##[[KeyPgType Type]]##
##**Base**## provides a way to explicitly access members of a specific base type, in the context of non-static methods of a user-defined type derived from another type using ##[[KeyPgExtends Extends]]##.
- Methods are only supported in the //[[CompilerOptlang -lang fb]]// dialect, hence ##**Base**## has no function in other dialects.
- ##[[KeyPgBaseInit Base (initializer)]]##
- ##[[KeyPgThis This]]##
- ##[[KeyPgType Type]]##
- ##[[KeyPgExtends Extends]]##
- ##[[KeyPgOptionBase Option Base]]##


Revision [17255]

Edited on 2014-09-09 15:40:56 by FxMwikki [For virtual methods, base.method() always calls the base method and never the overriding method.]
Additions:
For virtual methods, base.method() always calls the base method and never the overriding method.


Revision [16514]

Edited on 2012-12-26 13:18:33 by FxMwikki [Rename 'overriding' when misleading by using 'shadowing']
Additions:
##**Base**## is especially useful when a base type's member is shadowed by a local variable or member of a derived type using the same identifier. ##**Base**## then allows unambiguous access to the base type.
Deletions:
##**Base**## is especially useful when local variables or members of a derived type override a base type's members by using the same identifiers. ##**Base**## then allows unambiguous access to the base type.


Revision [16498]

Edited on 2012-12-22 08:08:48 by FxMwikki [Precise wording: added 'non-static' before 'method']
Additions:
Provides explicit access to base type members in non-static methods of a ##[[KeyPgType Type]]##
##**Base**## provides a way to explicitly access members of a specific base type, in the context of non-static methods of a user-defined type derived from another type using ##[[KeyPgExtends Extends]]##.
Deletions:
Provides explicit access to base type members in methods of a ##[[KeyPgType Type]]##
##**Base**## provides a way to explicitly access members of a specific base type, in the context of methods of a user-defined type derived from another type using ##[[KeyPgExtends Extends]]##.


Revision [16184]

Edited on 2012-05-23 18:21:45 by DkLwikki [Base() initializer description moved to new page]
Additions:
##**Base**## provides a way to explicitly access members of a specific base type, in the context of methods of a user-defined type derived from another type using ##[[KeyPgExtends Extends]]##.
By using ##**Base**## repeatedly, as in ##base.base.base.member##, it is possible to access any desired base type, in case there are multiple levels of inheritance.
##**Base**## is especially useful when local variables or members of a derived type override a base type's members by using the same identifiers. ##**Base**## then allows unambiguous access to the base type.
Deletions:
##**Base**## provides a way to explicitly access members of a specific base type, in the context of methods of a user-defined type derived from another type using ##[[KeyPgExtends Extends]]##. This is especially useful when local variables or members of a derived type override a base type's members if they are using the same identifiers. ##**Base**## then allows unambiguous access to the base type. By using ##**Base**## repeatedly, as in ##base.base.base.member##, it is possible to access any desired base type, in case there are multiple levels of inheritance.


Revision [16183]

Edited on 2012-05-23 18:20:08 by DkLwikki [Base() initializer description moved to new page]
Additions:
{{fbdoc item="title" value="BASE (member access)"}}----
- ##[[KeyPgBaseInit Base (initializer)]]##
Deletions:
{{fbdoc item="title" value="BASE"}}----
//or//
**base**()
##**Base()**## can also be used to call the base type constructor (at creation step) from within a directly derived type's constructor (where it must be the first statement), in order to ensure the base type is properly constructed. By using once ##**Base()**## in first statement of each derived type's constructor, it is possible to call any desired base type constructor, in case there are multiple levels of inheritance.
##**Base()**## is not a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()## statement which can be used wherever inside any member procedure and which always induces base type reconstruction.


Revision [16128]

Edited on 2012-02-14 06:53:16 by FxMwikki [Add use details about Base() that is not a shortcut for Base.Constructor() + extended example]
Additions:
Type Parent
As Integer a
Declare Constructor(ByVal As Integer = 0)
Declare Sub show()
End Type
Constructor Parent(ByVal a As Integer = 0)
This.a = a
End Constructor
Sub Parent.show()
Print "parent", a
End Sub
Type Child extends Parent
As Integer a
Declare Constructor(ByVal As Integer = 0)
Declare Sub show()
End Type
Constructor Child(ByVal a As Integer = 0)
Base(a * 3)
This.a = a
End Constructor
Sub Child.show()
Base.show()

Print "child", Base.a, a
End Sub
Type GrandChild extends Child
As Integer a
Declare Constructor(ByVal As Integer = 0)
Declare Sub show()
End Type
Constructor GrandChild(ByVal a As Integer = 0)
Base(a * 2)
This.a = a
End Constructor
Sub GrandChild.show()
Base.show()

'' Show both a fields, the base.base type's, the base type's and ours'
Print "grandchild", Base.Base.a, Base.a, a
End Sub
Dim As GrandChild x = GrandChild(3)
Deletions:
type Parent
as integer a
declare constructor(byval as integer)
declare sub show()
end type
constructor Parent(byval a as integer)
this.a = a
end constructor
sub Parent.show()
print "parent", a
end sub
type Child extends Parent
as integer a
declare constructor(byval as integer)
declare sub show()
end type
constructor Child(byval a as integer)
base(a * 2)
this.a = a
end constructor
sub Child.show()
base.show()
print "child", base.a, a
end sub
dim as Child x = Child(3)


Revision [16127]

Edited on 2012-02-14 06:44:03 by FxMwikki [Add use details about Base() that is not a shortcut for Base.Constructor()]
Additions:
##**Base()**## can also be used to call the base type constructor (at creation step) from within a directly derived type's constructor (where it must be the first statement), in order to ensure the base type is properly constructed. By using once ##**Base()**## in first statement of each derived type's constructor, it is possible to call any desired base type constructor, in case there are multiple levels of inheritance.
##**Base()**## is not a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()## statement which can be used wherever inside any member procedure and which always induces base type reconstruction.
Deletions:
##**Base()**## can also be used to call the base type constructor (at creation step) from within a directly derived type's constructor (where it must be the first statement), in order to ensure the base type is properly constructed. It is not a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()## statement which can be used inside any member procedure and which always induces base type reconstruction.


Revision [16126]

Edited on 2012-02-14 02:25:36 by FxMwikki [Base() is not a shortcut for Base.Constructor() because it does not induce reconstruction]
Additions:
##**Base()**## can also be used to call the base type constructor (at creation step) from within a directly derived type's constructor (where it must be the first statement), in order to ensure the base type is properly constructed. It is not a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()## statement which can be used inside any member procedure and which always induces base type reconstruction.
Deletions:
##**Base()**## can also be used to call the base type constructor (at creation step) from within a derived type's constructor (it must be the first statement), in order to ensure the base type is properly constructed. It is not a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()## statement which can be used inside any member procedure and which always induces reconstruction of the base type.


Revision [16125]

Edited on 2012-02-13 15:07:05 by FxMwikki [Base() is not a shortcut for Base.Constructor() because it does not induce reconstruction]
Additions:
##**Base()**## can also be used to call the base type constructor (at creation step) from within a derived type's constructor (it must be the first statement), in order to ensure the base type is properly constructed. It is not a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()## statement which can be used inside any member procedure and which always induces reconstruction of the base type.
Deletions:
##**Base**## can also be used to call base type constructors from within a derived type's constructors, in order to ensure the base type is properly initialized. Currently this appears to be a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()##.


Revision [15827]

Edited on 2012-01-24 15:39:05 by CountingPine [Formatting]
Additions:
##**Base**## provides a way to explicitly access members of a specific base type, in the context of methods of a user-defined type derived from another type using ##[[KeyPgExtends Extends]]##. This is especially useful when local variables or members of a derived type override a base type's members if they are using the same identifiers. ##**Base**## then allows unambiguous access to the base type. By using ##**Base**## repeatedly, as in ##base.base.base.member##, it is possible to access any desired base type, in case there are multiple levels of inheritance.
##**Base**## can also be used to call base type constructors from within a derived type's constructors, in order to ensure the base type is properly initialized. Currently this appears to be a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()##.
- Methods are only supported in the //[[CompilerOptlang -lang fb]]// dialect, hence ##**Base**## has no function in other dialects.
Deletions:
**Base** provides a way to explicitly access members of a specific base type, in the context of methods of a user-defined type derived from another type using ##[[KeyPgExtends Extends]]##. This is especially useful when local variables or members of a derived type override a base type's members if they are using the same identifiers. **Base** then allows unambiguous access to the base type. By using **Base** repeatedly, as in ##base.base.base.member##, it is possible to access any desired base type, in case there are multiple levels of inheritance.
**Base** can also be used to call base type constructors from within a derived type's constructors, in order to ensure the base type is properly initialized. Currently this appears to be a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()##.
- Methods are only supported in the //[[CompilerOptlang -lang fb]]// dialect, hence **Base** has no function in other dialects.


Revision [15821]

Edited on 2012-01-24 10:25:26 by DkLwikki [Add description, example, etc]
Additions:
Provides explicit access to base type members in methods of a ##[[KeyPgType Type]]##
**base**.//member//
**base** [ .**base** ... ] .//member//
//or//
**base**()
**Base** provides a way to explicitly access members of a specific base type, in the context of methods of a user-defined type derived from another type using ##[[KeyPgExtends Extends]]##. This is especially useful when local variables or members of a derived type override a base type's members if they are using the same identifiers. **Base** then allows unambiguous access to the base type. By using **Base** repeatedly, as in ##base.base.base.member##, it is possible to access any desired base type, in case there are multiple levels of inheritance.

**Base** can also be used to call base type constructors from within a derived type's constructors, in order to ensure the base type is properly initialized. Currently this appears to be a shortcut for ##**Base**.[[KeyPgConstructor Constructor]]()##.
{{fbdoc item="filename" value="examples/manual/udt/base.bas"}}%%(freebasic)
type Parent
as integer a
declare constructor(byval as integer)
declare sub show()
end type
constructor Parent(byval a as integer)
this.a = a
end constructor
sub Parent.show()
print "parent", a
end sub
type Child extends Parent
as integer a
declare constructor(byval as integer)
declare sub show()
end type
constructor Child(byval a as integer)
'' Call base type's constructor
base(a * 2)
this.a = a
end constructor
sub Child.show()
'' Call base type's show() method, not ours
base.show()

'' Show both a fields, the base type's and ours'
print "child", base.a, a
end sub
dim as Child x = Child(3)
x.show()
%%
- Methods are only supported in the //[[CompilerOptlang -lang fb]]// dialect, hence **Base** has no function in other dialects.
- New to ""FreeBASIC""
- ##[[KeyPgThis This]]##
Deletions:
Provides access to the derived type's base type
- ##[[KeyPgOpIs Operator Is]]##


Revision [15811]

Edited on 2012-01-24 03:35:14 by FxMwikki [Is -> Operator Is (in links list)]
Additions:
Provides access to the derived type's base type
Deletions:
Provides access to a derived type's base type


Revision [15809]

Edited on 2012-01-24 02:24:00 by FxMwikki [Is -> Operator Is (in links link)]
Additions:
- ##[[KeyPgOpIs Operator Is]]##
Deletions:
- ##[[KeyPgIs Is]]##


Revision [15645]

The oldest known version of this page was created on 2012-01-13 11:32:03 by CountingPine [Is -> Operator Is (in links link)]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode