class Trip {
module final performTrip {
.doComingTransport
.doDayA
.doDayB
.doDayC
.doReturningTransport
}
module doComingTransport {
error "abstract"
}
module doDayA {
error "abstract"
}
module doDayB() {
error "abstract"
}
module doDayC() {
error "abstract"
}
module doReturningTransport {
error "abstract"
}
}
class PackageA as Trip {
module doComingTransport {
Print "The tourists are coming by air ..."
}
module doDayA {
Print "The tourists are visiting the aquarium ..."
}
module doDayB {
Print "The tourists are going to the beach ..."
}
module doDayC {
Print "The tourists are going to mountains ..."
}
module doReturningTransport {
Print "The tourists are going home by air ..."
}
}
class PackageB as Trip {
module doComingTransport {
Print "The tourists are comming by train ..."
}
module doDayA {
Print "The tourists are visiting the mountain ..."
}
module doDayB {
Print "The tourists are going to the beach ..."
}
module doDayC {
Print "The tourists are going to zoo ..."
}
module doReturningTransport {
Print "The tourists are going home by train ..."
}
}
Print "First Trip"
M=PackageB()
M.performTrip
Print "Next Trip"
M=PackageA()
M.performTrip
module final performTrip {
.doComingTransport
.doDayA
.doDayB
.doDayC
.doReturningTransport
}
module doComingTransport {
error "abstract"
}
module doDayA {
error "abstract"
}
module doDayB() {
error "abstract"
}
module doDayC() {
error "abstract"
}
module doReturningTransport {
error "abstract"
}
}
class PackageA as Trip {
module doComingTransport {
Print "The tourists are coming by air ..."
}
module doDayA {
Print "The tourists are visiting the aquarium ..."
}
module doDayB {
Print "The tourists are going to the beach ..."
}
module doDayC {
Print "The tourists are going to mountains ..."
}
module doReturningTransport {
Print "The tourists are going home by air ..."
}
}
class PackageB as Trip {
module doComingTransport {
Print "The tourists are comming by train ..."
}
module doDayA {
Print "The tourists are visiting the mountain ..."
}
module doDayB {
Print "The tourists are going to the beach ..."
}
module doDayC {
Print "The tourists are going to zoo ..."
}
module doReturningTransport {
Print "The tourists are going home by train ..."
}
}
Print "First Trip"
M=PackageB()
M.performTrip
Print "Next Trip"
M=PackageA()
M.performTrip
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου
You can feel free to write any suggestion, or idea on the subject.