Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:43:36+00:00 2026-06-04T15:43:36+00:00

Consider: Public MustInherit Class Column Public ReadOnly Property ReturnSomethingUseful() As Object Get ‘return something

  • 0

Consider:

Public MustInherit Class Column
    Public ReadOnly Property ReturnSomethingUseful() As Object
        Get
             'return something useful
        End Get
    End Property
End Class

Public Class TypedColumn(Of T)
    Inherits Column

    Public Overrides ReadOnly Property ReturnSomethingUseful() As T
        Get
             'return the same something useful, but as type T
             Return MyBase.ReturnSomethingUseful()
        End Get
    End Property
End Class

But this gives the following error:

Public Overrides Function ReturnSomethingUseful(sValue As String) As Boolean’
cannot override ‘Public Overridable Function ReturnSomethingUseful(sValue As String) As Object’
because they differ by their return types.

I accept that you can’t do this, but I’d like to be able to preserve the semantics of what I’m trying to do, which is to have an untyped version that deals with Object, but a typed version in derived classes that knows about the specific type T. Is there any way to accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:43:37+00:00Added an answer on June 4, 2026 at 3:43 pm

    I don’t love this answer, but here’s what I’m doing until I can find a truly elegant solution to this problem:

    Public Class TypedColumn(Of T)
        Inherits Column
    
        Public ReadOnly Property ReturnSomethingUsefulTyped() As T
            Get
              'return the same something useful, but as type T
              Return MyBase.ReturnSomethingUseful()
            End Get
        End Property
    End Class
    

    So instead of overriding the base method, it’s just got a different name that indicates what it does. Not wonderful, but better than dealing with type Object and also better than the problems with Shadows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider following code public class City { public string Name { get { return
Consider this class: public class Column<T> { public string Header { get; set; }
Consider the following class hierarchy: public class Foo { public string Name { get;
Consider this abstract class public abstract class Foo { public Injectable Prop {get;set;} }
Consider: class Foo { public string Name{get;set;} public string[] WebSites{get;set;} } I have a
Consider the following objects: Public MustInherit Class FileRepository Public MustOverride Sub SaveStringToFile(ByVal FileText As
Consider the following: public class Box { public BoxSize Size { get; set; }
Consider this container: public class ItemInfo : DependencyObject { public string Name { get;
Consider these classes: public class BaseClass { public int SomeInt { get; set; }
Consider this public Object doGet() { return getResource(); } private Object getResource() { synchronized

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.