Results 1 to 7 of 7

Thread: [RESOLVED] Same interface, base and derived class.

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member DavesChillaxin's Avatar
    Join Date
    Mar 2011
    Location
    WNY
    Posts
    451

    Resolved [RESOLVED] Same interface, base and derived class.

    I'm struggling here.. I know I can disable the warning manually. However I'm not sure if this would be the right way to go about this.

    Here's my interface..
    vbnet Code:
    1. Public Interface IPopulatingClassBase
    2.     Property Identity() As Int64
    3.     ReadOnly Property Dirty() As Boolean
    4.     Sub Populate_Class(ByVal RecordID As Int64)
    5.     Sub Save_Class()
    6.     Sub Reset_Class()
    7. End Interface


    Here's my parent class...
    vbnet Code:
    1. Public Class Parent
    2. Implements IPopulatingClassBase
    3.  
    4.     Public Property Identity() As Int64 _
    5.     Implements IPopulatingClassBase.Identity
    6.         '...
    7.     End Property
    8.  
    9.     Private Dirty() As Boolean = {False, False}
    10.     Public ReadOnly Property Dirty() As Boolean _
    11.     Implements IPopulatingClassBase.Dirty
    12.         '...
    13.     End Property
    14.  
    15.  
    16.     Friend Sub Populate_Class(ByVal ParentID As Int64) _
    17.     Implements IPopulatingClassBase.Populate_Class
    18.         '...
    19.     End Sub
    20.  
    21.     Friend Sub Save_Class() _
    22.     Implements IPopulatingClassBase.Save_Class
    23.         '...
    24.     End Sub
    25.  
    26.     Public Sub Reset_Class() _
    27.     Implements IPopulatingClassBase.Reset_Class
    28.         '...
    29.     End Sub
    30.  
    31. End Class


    Here's my derived class..
    vbnet Code:
    1. Public Class Derived
    2. Inherits Parent
    3. Implements IPopulatingClassBase
    4.  
    5.     Public Property Identity() As Int64 _
    6.     Implements IPopulatingClassBase.Identity
    7.         '...
    8.     End Property
    9.  
    10.     Private Dirty() As Boolean = {False, False}
    11.     Public ReadOnly Property Dirty() As Boolean _
    12.     Implements IPopulatingClassBase.Dirty
    13.         '...
    14.     End Property
    15.  
    16.  
    17.     Friend Shadows Sub Populate_Class(ByVal DerivedID As Int64) _
    18.     Implements IPopulatingClassBase.Populate_Class
    19.         '...
    20.     End Sub
    21.  
    22.     Friend Shadows Sub Save_Class() _
    23.     Implements IPopulatingClassBase.Save_Class
    24.         '...
    25.     End Sub
    26.  
    27.     Public Shadows Sub Reset_Class() _
    28.     Implements IPopulatingClassBase.Reset_Class
    29.         '...
    30.     End Sub
    31.  
    32. End Class

    I obviously get the warnings in the derived class, but I feel this should be allowed. I've read vb.net doesn't whereas c# does. Is there a way around this or should I just create separate interfaces? (Which I feel defeats the entire purpose of an interface.)

    PS In my example think of it as classes that populate with data from a database. The parent class would be an organization, and the derived class a location. Both populate and have similar functionality. The only difference is locations are an entity of an organization(the data record for a location constraints it to an organization) upon loading location data I also populate the organization class. This is a real example of what my project does.. so having said I just want to know how I can get around this warning, and if not would it have any consequences if I left it as-is.


    Thanks in advance
    David
    Last edited by DavesChillaxin; May 11th, 2012 at 11:03 AM.
    Please rate if my post was helpful!
    Per favore e grazie!




    Code Bank:
    Advanced Algebra Class *Update | True Gradient Label Control *Dev | A Smarter TextBox *Update | Register Global HotKey *Update
    Media Library Beta *Dev | Mouse Tracker (Available in VB.net and C#.net) *New | On-Screen Numpad (VB.net) *New

Tags for this Thread

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