65.9K
CodeProject is changing. Read more.
Home

Safely Calling Virtual Members From Constructors...

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.86/5 (5 votes)

Mar 23, 2015

CPOL

1 min read

viewsIcon

19143

downloadIcon

43

Many programmers know what calling virtual members from not sealed class constructor may cause runtime error, because some members used in virtuals could be not initialized. I will show a simple way to call virtuals safely from constructors of inherited classes.