Quantcast
Viewing all articles
Browse latest Browse all 35736

Overriding an Abstract Property vs. Passing a Parameter

An abstract class may require a value to be passed through the constructor like the following example: public abstract class Node { private readonly Uri _uri; protected Node( string address, string relativePath) { _uri = new Uri(Path.Combine(address, relativePath)); } } public class Element : Node { private const string relativePath = "/path" ; public Element( string address) : base (address, relativePath) { } } Alternatively, it can require that derived types implement...(read more)Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 35736

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>