The polymorphism tag has no wiki summary.
1
vote
2answers
60 views
Null Object pattern with simple class hierarchy
I have a simple two-class hierarchy to represent U.S. ZIP (12345) and ZIP+4 (12345-1234) codes. To allow clients to allow both types for a field/parameter or restrict it to one type or the other, the ...
1
vote
0answers
40 views
Hardware resource Open/Close methods
So I'm making a program that is a serial port wedge. In other words I want it to listen to a serial port. If data comes in, wait a given amount of time, then play a sound and finally send the data ...
1
vote
4answers
132 views
Understanding Interface
//program.cs
class Program
{
static void Main(string[] args)
{
Dog oDog = new Dog();
Console.WriteLine(oDog.Cry());
Cat oCat = new Cat();
...
0
votes
1answer
97 views
Is this the proper way to find the subclass of a polymorphic superclass?
I came across polymorphism in the book that I'm reading and decided to do a little experiment. Essentially what I did was to create a base class called Asset and two subclasses that derive from Asset, ...