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

  • Home
  • SEARCH
  • 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 8437435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:25:35+00:00 2026-06-10T07:25:35+00:00

I’m getting a compilation error on following code: public abstract class DbHandler<T> { public

  • 0

I’m getting a compilation error on following code:

public abstract class DbHandler<T>
{
    public abstract bool Save(T obj);
    ...
}

and its implementing class:

 public class SpaghettiTableDb : DbHandler<SpaghettiTable>
 {
    public bool Save(SpaghettiTable obj)
    {
        return false;
    }
    ...
 }

The error is :

'SpaghettiTableDb' does not implement inherited abstract member 'SeatPicker.DbHandler<SeatPicker.SpaghettiTable>.Save(SeatPicker.SpaghettiTable)'

But I think it does, so I’m not sure why I’m receiving this error.

(SpaghettiTable is just a class with some properties, nothing more)

Any help?

  • 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-10T07:25:37+00:00Added an answer on June 10, 2026 at 7:25 am

    You need to use the override keyword. Otherwise you’re not implementing the abstract base class and just creating a “new” separate method on the subclass.

    public override bool Save(SpaghettiTable obj)
    {
        return false;
    }
    

    Think of abstract methods just like virtual methods that you override. The only difference is that you force subclasses to provide an implementation of that method whereas virtual methods provide their own implementation that subclasses can optionally override with their own implementation.

    EDIT: Additionally, if you want to make your life easier in Visual Studio, you can right-click (or ctrl+.) on the inheritance declaration and choose “implement abstract class” (or something like that, I don’t have VS with me right now) which will automatically create all the overridden methods for you.

    public class SpaghettiTableDb : DbHandler<SpaghettiTable> //right-click on "DbHandler"

    Alternatively, in the empty code space within your class, you can start typing “override”, then the IntelliSense will list all overridable members from the base class and when you pick one it will automatically write a default implementation for you.

    EDIT:
    Just to extend on what you have in your code, without the override keyword, you are creating a new method that belongs to your subclass and not overriding the base class. When you call that method but from the context of using the base class, it won’t call your subclass implementation since it doesn’t override the base method.

    Consider the following classes. (I’m using virtual instead of abstract just so it compiles and have it simpler)

    public class BaseClass
    {
        public virtual void Print()
        {
            Console.WriteLine("base print");
        }
    
        public virtual void AnotherPrint()
        {
            Console.WriteLine("base another print");
        }
    }
    
    public class SubClass : BaseClass
    {
        public override void Print()
        {
            Console.WriteLine("sub print");
        }
    
        public void AnotherPrint()
        {
            Console.WriteLine("sub another print");
        }
    }
    

    Note that SubClass.AnotherPrint does not override BaseClass.AnotherPrint.

    And when you use code like:

    SubClass mySub = new SubClass();
    
    mySub.Print(); //sub print
    mySub.AnotherPrint(); //sub another print
    
    BaseClass myBase = mySub;
    
    myBase.Print(); //sub print
    myBase.AnotherPrint(); //base another print
    

    Note that through the code, mySub and myBase both point to the same object, but one is typed as SubClass and the other as BaseClass. When the runtime calls myBase.Print(), it can easily check the inheritance of the classes and see that SubClass has overridden the Print method and calls the SubClass implementation. However, since SubClass.AnotherPrint wasn’t explicitly marked with override, the runtime/compiler considers that to be a completely different method with no link to the BaseClass.AnotherPrint method. Thus the runtime sticks with the base class implementation. When your instance is typed as the SubClass though, the compiler does see that you’re pointing to that new method and essentially not to the base implementation.

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

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.