Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

C# polymorphism trouble

$
0
0

I can't access the derived class public members below. How do I do this?

public class WhateverBase
    {
        public int iMin = 0;
        public int iMax = 0;

        public WhateverBase()
        {
            iMin = 0;
            iMax = 0;
        }
    }

public class MSH : WhateverBase
    {
        public String strDatatype = "";
        public String strUsage = "";
        public String strName = "";

        public MSH() : base()
        {
            strDatatype = "";
            strUsage = "";
            strName = "";
        }
    }

In main()...

WhateverBase wbObj = null;
wbObj = new MSH();

// Only iMin and iMax are exposed. I can't access //strDatatype, strUsage or strName. How can I do this?


Viewing all articles
Browse latest Browse all 31927

Trending Articles



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