By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,248 Members | 1,498 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,248 IT Pros & Developers. It's quick & easy.

Q re Bridge Design Pattern - Abstract Classes vs Interfaces

P: n/a
Hi

I'm just working through (and learning) the standard GoF Design Pattern and
the example of the Bridge pattern on
http://www.dofactory.com/Patterns/Pa...ge.aspx#_self2

I notice at the heart of the real world example is an abstract class

MustInherit Class DataObject
Public MustOverride Sub NextRecord()
Public MustOverride Sub PriorRecord()
Public MustOverride Sub NewRecord(ByVal name As String)
Public MustOverride Sub DeleteRecord(ByVal name As String)
Public MustOverride Sub ShowRecord()
Public MustOverride Sub ShowAllRecords()
End Class

which gets inherited by another class CustomerData which populates itself
with various customers.

I'm wondering why an abstract class is used here rather than an interface.

Could someone help me out pls?

Thanks

Simon
Jul 19 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Simon Woods" <si****************@virgin.netschrieb
Hi

I'm just working through (and learning) the standard GoF Design
Pattern and the example of the Bridge pattern on
http://www.dofactory.com/Patterns/Pa...ge.aspx#_self2

I notice at the heart of the real world example is an abstract class

MustInherit Class DataObject
Public MustOverride Sub NextRecord()
Public MustOverride Sub PriorRecord()
Public MustOverride Sub NewRecord(ByVal name As String)
Public MustOverride Sub DeleteRecord(ByVal name As String)
Public MustOverride Sub ShowRecord()
Public MustOverride Sub ShowAllRecords()
End Class

which gets inherited by another class CustomerData which populates
itself with various customers.

I'm wondering why an abstract class is used here rather than an
interface.
I wonder, too (not knowing the book). Maybe the base class will be extended
by "content" in the following chapters? Otherwise, I'd probably choose an
Interface.
Armin

Jul 19 '07 #2

P: n/a
"Simon Woods" <si****************@virgin.netwrote in
news:##**************@TK2MSFTNGP06.phx.gbl:
I'm wondering why an abstract class is used here rather than an
interface.
I guess it gives more flexiblity in the future - you can always extend the
base class with additional features easily (i.e. base implementations).
With an interface, you would need to update the entire project.
Jul 19 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.