This is not a watir, but a ruby question.
In application under test, some items have attachments, some have
description, and some have both.
I know ruby does not support multiple inheritance, so I made class
ItemDescriptionAttachment that has some redundant code ("attr_reader
:attachments" and "@attachments=attachments").
Can class ItemDescriptionAttachment inherit "attr_reader :attachments" and
"@attachments=attachments" from class ItemAttachment?
Thaks.
This is my code:
class Item
attr_reader :title
def initialize(title)
@title=title
end
end
class ItemAttachment < Item
attr_reader :attachments
def initialize(title,attachments=nil)
super(title)
@attachments=attachments
end
end
class ItemDescription < Item
attr_reader :description
def initialize(title,description=nil)
super(title)
@description=description
end
end
class ItemDescriptionAttachment < ItemDescription
attr_reader :attachments
def initialize(title,description=nil,attachments=nil)
super(title,description)
@attachments=attachments
end
end
Zeljko
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general