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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:31:22+00:00 2026-06-12T12:31:22+00:00

I have these: public class TennisPlayer { } public class RogerFederer : TennisPlayer {

  • 0

I have these:

public class TennisPlayer
{

}

public class RogerFederer : TennisPlayer
{

}

public class RafaelNadal : TennisPlayer
{

}

And then I have some classes with methods, like these:

public abstract class Manager
{
    protected abstract void ScheduleFriendlies(TennisPlayer player);
}

public class RafaelNadalManager : Manager
{
    public void ScheduleFriendlies(RafaelNadal rn)
    {
        //throw new NotClayException();
    }
}

public class RogerFedererManager : Manager
{
    public void ScheduleFriendlies(RogerFederer rf)
    {
        //throw new NotGrassException();
    }
}

//'RafaelNadalManager' does not implement inherited abstract member 'Manager.ScheduleFriendlies(TennisPlayer)'

The thing I’m trying to achieve is that I would want to have child classes of Manager but every such class will be tied to one player and hence the methods in those child classes (Manager classes) will be specific to that player. In other words Roger should have his own ScheduleFriendlies while Rafael should have his own.

How do I go about this? Alternate designs would do, but keep in mind:

What I can alter: The inheritances, its routes etc

But do not have the luxury to: Take off child manager classes and merge into one (in other words, I need RogerFederer and RogerFedererManager as separate classes).

I tried this:

public abstract class Manager
{
    protected abstract bool ScheduleFriendlies<T>(T player) where T : TennisPlayer;
}

public class RafaelNadalManager : Manager
{
    protected override bool ScheduleFriendlies<T>(T player)
    {
        //but how do I enforce the caller that only RafaelNadal object can be 
        //passed to this but not RogerFederer?
    }
}
  • 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-12T12:31:23+00:00Added an answer on June 12, 2026 at 12:31 pm

    You were close, but you need the class generic, not just the method:

    public abstract class Manager<T> where T : TennisPlayer
    {
        protected abstract bool ScheduleFriendlies(T player);
    }
    

    You could then use:

    public class RafaelNadalManager : Manager<RafaelNadal>
    {
         protected override bool ScheduleFriendlies(RafaelNadal player)
         {}
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these classes: public abstract class CustomField { public String Id { get;
Let's say I have these classes: public class BaseMapClass<T1, T2> { protected T1 Thing1;
I have ViewModel classes like these that follow: public class ReferenceDetailsViewModel { public ReferenceDetailsViewModel()
I need some help in my application. I have these classes: Ajuda.class : public
I have these classes: public class AllegationContent { @DatabaseField(generatedId = true) protected long id;
Concerning data binding I have these classes: public class Foo : List<Bar> { public
I have these two classes public class Person { } public class Company {
Let's say we have these two classes: public class Base { public static int
Let's say I have these class hierarchy : public abstract class Parent { }
I have these classes in C# (.NET Framework 3.5) described below: public class Base

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.