Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
A := new product("cheese")
B := new purchase(A)
B.price:=1
A.msgbox()
B.msgbox()
exitapp
class product
{
title:=""
__New(title:="")
{
this.title:=title
return this
}
info()
{
temp:= this.title ;%
return temp
}
msgbox()
msgbox % this.info() ;%
}
class purchase extends product
{
price:=0
__New(r_product:="")
{
if IsObject(r_product)
this:=r_product
return this
}
info() ; override base.info()
;I want to extend the funtionality of this method, so it would include the data, which exists only in purchase
{
temp:=base.info()
temp:= temp . "`n" . this.price ;%
return temp
}
msgbox() ; override base.msgbox()
msgbox this.info()
}
I tried the example in manual Here but its not exactly what I need and did not work.
I also tried looking for examples/tutorials on the Net but I found zero results regarding this topic.
Some other things I tried:
Tut about using objects couldn't help :(.
Any help would be greatly appreciated,
Thank you