docs
docs copied to clipboard
Calling base class method from derived class error
ivedClass B = new DerivedClass(); B.DoWork(); // Calls the new method.
BaseClass A = (BaseClass)B; A.DoWork(); // Calls the old method.
and the code snippet below are in conflict... Kindly resolve which is correct.
DerivedClass B = new DerivedClass(); B.DoWork(); // Calls the new method.
BaseClass A = (BaseClass)B; A.DoWork(); // Also calls the new method.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: d1ebd197-8f01-b8d7-45d6-1a7afba572b4
- Version Independent ID: 0790b314-a794-6ce3-15f0-37281faa00a6
- Content: Polymorphism - C# Programming Guide
- Content Source: docs/csharp/programming-guide/classes-and-structs/polymorphism.md
- Product: dotnet-csharp
- GitHub Login: @BillWagner
- Microsoft Alias: wiwagn
Okay.. Thanks