Trying to figure out what would be seen here. I did a sample project, and it seems to be doing what I expected. Let's say I had two classes
-------------------------
class Nut{}
class PeaNut:Nut{}
-------------------------
I then create a method like so:
-------------------------
public void Update(Nut n)
{
Console.WriteLine( n.ToString() );
}
-------------------------
If I pass a Peanut to the Update method, it's type will be aknowledged as a Peanut, and not a Nut, right? Basically if a method argument takes a base class, I can still see the parent class when I access the method argument's base type?
I believe, and correct me if I'm wrong:
The use of an abstract class for a method argument is similar to using an interface, in this capacity.
-------------------------
class Nut{}
class PeaNut:Nut{}
-------------------------
I then create a method like so:
-------------------------
public void Update(Nut n)
{
Console.WriteLine( n.ToString() );
}
-------------------------
If I pass a Peanut to the Update method, it's type will be aknowledged as a Peanut, and not a Nut, right? Basically if a method argument takes a base class, I can still see the parent class when I access the method argument's base type?
I believe, and correct me if I'm wrong:
The use of an abstract class for a method argument is similar to using an interface, in this capacity.