Results 1 to 13 of 13

Thread: how to turn off a public member in a derived class

Hybrid View

  1. #1
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261
    What about something like this:

    Code:
    public class MyClassA
    
         Public Property Whatever
             ...
          End Property
    
    End Class
    
    Public Class MyClassB
               inherits MyClassA
    
               Private Shadows Property Whatever
                 ...
               End Property
    
    End Class
    I havn't tried it yet, but I'm 99% sure it will work.

    EDIT:

    Never mind. It doesn't work (darn).

    However, it just occured to me, that you really shouldn't be allowed to do this. Inheritance, by definition, allows derived classes to work exactly the same way as their base classes. If certain members have a different scope in derived classes, you completely lose that compatibility. (Example: I often pass a Bitmap object to the Graphics.drawImage procedure, eventhough drawImage accepts only the Image object. Since Bitmap is inherited from Image, I can often use them interchangably).
    Last edited by Hu Flung Dung; Jan 18th, 2003 at 12:30 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width