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 1063823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:50:30+00:00 2026-05-16T18:50:30+00:00

I have a class that have a different Add method than the other classes

  • 0

I have a class that have a different Add method than the other classes and therefor cant implement the same interface… Should I split the current interface so it can use it too or should I just create another interface for it?

UPDATE:

public interface IProductRepository<T, T2>
    where T : class
    where T2 : class
{
    void Add(T model, int categoryId);
    void Edit(T model, int id);
    void Delete(int id);

    T2 Get(int id);
}

As you see then the interface above have an Add method which requires a categoryId.

My Category class is the same as above but without the categoryId parameter in the Add method. Should I just create a new interface for the Category class?

  • 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-05-16T18:50:30+00:00Added an answer on May 16, 2026 at 6:50 pm

    Think about what is for it.

    Maybe your other class don’t seems to be like to functionality of this interface rather than doing same action (adding). Then you can create other interface for this new (new other) type of classes or leave this class alone without abstract interface.

    Maybe you want do some refactoring on other class to get definition of Add() smillar in interface.

    If you can’t refactor other class and this class seems to have this interface.
    Then you create other interface or in old interface new Function like Add_Extended() for adding functionality with other arguemnt list.

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

Sidebar

Related Questions

Most inheritance questions I've seen assume that the child classes have different attributes than
I have class that represents users. Users are divided into two groups with different
I have this class that has many class members, and a lot of different
I have two different projects and in one, I have a class that defines
Let's say that I have a bunch of class instances that serve different purposes,
I have created a button CSS class that uses background images with different positions
I have a Test Class, that test the access of all page with different
I have class that extend FragmentActivity in it I add fragment to layout as
Assume that I have a class with a readonly property on it. //MyClass.h @interface
I have a website that is hosted in a different timezone than the users

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.