Рет қаралды 1,419
Become a patron and get access to source code and exclusive live streams: / calling-virtual-81380300
In this video, we are investigating the issues that can exist in a class where its constructor is making a call to a virtual method - specifically, the method that is overridden in the derived class.
After discovering a bug, and even making a couple of half-baked attempts to solve it, we are moving to a general solution to the problem. By the means of object-oriented design, and accepting that the constructor cannot use object's state for its purpose (it is the constructor the one to construct that state!), you will learn the coding technique where data are passed safely between constructors, removing any need for calling virtual methods at that stage.
Learn more from video courses:
Beginning Object-oriented Programming with C# ► codinghelmet.c...
Collections and Generics in C# ► codinghelmet.c...
Making Your C# Code More Object-oriented ► codinghelmet.c...
Other courses at Pluralsight ► codinghelmet.c...
Other courses at Udemy ► codinghelmet.c...
Other videos on this channel you may be interested in watching:
Using GitHub Copilot to Write Complex Code | Step-by-step Tutorial ► • Using GitHub Copilot t...
Coding with GitHub Copilot - Beginner to Master | VS Code Demo ► • A Comprehensive Guide ...
What is Covariance and Contravariance in C# ► • What is Covariance and...
How to Initialize a Clean ASP.NET Core Project with Entity Framework Core and Identity ► • How to Initialize a Cl...
The Null Conundrum: A Guide to Optional Objects in C# ► • How to Avoid Null Refe...