locked
Inherited Member being hidden RRS feed

  • Question

  • User1329262882 posted

    Heya,

    I'm attempting to upgrade a web site originally developed in 1.1 that has been migrated to 2.0 & 3.5 over the years, up to 4.0.  Currently, I only have access to Visual Web Developer 2010 Express, & have been copying old files into a new solution bit by bit & squashing the bugs as they come up.  There are a couple warnings that confuse me:

    <derived control>.Profile hides inherited member <base control>.Profile.
    Use the new keyword if hiding was intended. ..\781f76f0\ece8b0f2\App_Web_q1ixf3o4.0.cs
    <derived control>.ApplicationInstance hides inherited member <base control>.ApplicationInstance.
    Use the new keyword if hiding was intended. ..\781f76f0\ece8b0f2\App_Web_q1ixf3o4.0.cs



    Here's the interesting part:  the base control doesn't have the members Profile or ApplicationInstance.  The base control derives from System.Web.UI.UserControl.  Has that class changed in some way in 4.0 to have these members?  & why do the warnings come from the pre-compiled file, but not the code behind file?

    Basically, how do I squash these warnings?

    - O8

    Tuesday, January 17, 2012 5:13 AM

Answers

  • User3866881 posted

    the code base is quite large, & it doesn't look like I can attach files...  is there something in particular you are looking for?  perhaps I can make a new simplified version that generates the same issue & copy that in?

    Hello again:)

    I just want to see your current codes to make sure whether it's the code problem……Just like the sample I've offered to you to reproduce the problem issue……。Make sure that if there's an abstract function in your father's class,you must use "override" instead of using "new"。

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, January 21, 2012 4:14 AM

All replies

  • User3866881 posted

    Hello:)

    Due to the problem,I think it's because you've had a function whose name with its parameters the same as what it is inherits from its father(base class)……,So this will cause the problem。See this sample below(this will raise the error)

    namespace A
    {
        class Father
        {
            public void A()
            {

            }
        }

        class B:Father
        {
            public void A() //you must exclipitly use public new…… to override this kind of problem
            {

            }
        }
    class Program
    {
    static void Main(string[] args)
    {
               
    }
    }
    }
    Wednesday, January 18, 2012 8:20 PM
  • User1329262882 posted
    Yeah, I get the inheritance. The prob is that neither the base nor derived classes have Profile & ApplicationInstance as members. The only idea I have is that the .net UserControl class that the base class derives from has changed to include these members & require them to be overridden (which I believe means they would have to be marked as "abstract"?). I'm not certain if this I the case, but without changing the code when upgrading to .net 4, these warnings now appear. - O8
    Thursday, January 19, 2012 3:39 AM
  • User3866881 posted

    Hello again:)

    Would you mind showing us your codes so as to let me check it?

    Reguards!

    Friday, January 20, 2012 7:08 AM
  • User1329262882 posted

    the code base is quite large, & it doesn't look like I can attach files...  is there something in particular you are looking for?  perhaps I can make a new simplified version that generates the same issue & copy that in?

    Friday, January 20, 2012 7:14 AM
  • User3866881 posted

    the code base is quite large, & it doesn't look like I can attach files...  is there something in particular you are looking for?  perhaps I can make a new simplified version that generates the same issue & copy that in?

    Hello again:)

    I just want to see your current codes to make sure whether it's the code problem……Just like the sample I've offered to you to reproduce the problem issue……。Make sure that if there's an abstract function in your father's class,you must use "override" instead of using "new"。

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, January 21, 2012 4:14 AM