'Do inheritances automatically get inherited by all child classes in C#
Something I was just testing with a simple using() statement.
Got 2 classes: Child and Parent
public class Parent : IDisposable
{
public void Dispose()
{
// disposing stuff
}
}
public class Child : Parent
{
public void Dispose()
{
// disposing stuff
}
}
Now when I start using Using() statements:
using(Parent = new Parent()){}
Dispose does get called for Parent
using(Child = new Child()){}
Dispose isn't called
Unless I specifically add:
public class Child : Parent, IDisposable
Or am I overlooking something?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
