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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:59:17+00:00 2026-05-26T16:59:17+00:00

i have Abstract class Public class Abstract baseClass { public abstract string GetString(); public

  • 0

i have Abstract class

Public class Abstract baseClass
{
     public abstract string GetString();
     public abstract string GetString1();
}

public class DerivedClass : baseClass
{
      public override string GetString()
        {
            return "test data";
        }

    public override string GetString1()
    {
        throw new NotImplementedException();
    }
}

In above line of code, i have to implement both abstract method in derived class. But due to some reason i don’t want to implement all methods, just one of them like GetString() only. How can it be done?

Thanks

  • 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-26T16:59:18+00:00Added an answer on May 26, 2026 at 4:59 pm

    If DerivedClass is going to offer common functionality to other classes, you can mark it as abstract, implement one of the methods here, and then inheritors will only have to implement the remaining method.

    If you aren’t going to support the other method in a given implementation, you still have to expose the method in your class, but similar to what you have here, you would typically throw a NotSupportedException. For void methods, you could simply return (do nothing).

    Finally, if you want to separate out the things that have both methods and those that have only one, you can use interfaces.

    public interface IBase
    {
        string GetString();
    }
    
    public interface IBasePlus : IBase
    {
        string GetStringPlus();
    }
    

    You can have one class that implements IBasePlus, but you can supply this to methods that take a parameter of type IBase, in which case you won’t see the extra method.

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

Sidebar

Related Questions

If have following class public abstract class MyBaseClass : BaseClass { public override string
I have a situation like this: public abstract class BaseClass { public abstract string
i have an abstract class BaseClass with a public insert() method: public abstract class
I have the following class: public abstract class AbstractParent { static String method() {
I have this code structure: public abstract class ContentEntryBase { public string UniqueIdentifier; public
I have the following class hierarchy public abstract BaseClass : System.Web.UI.UserControl { public virtual
i have the following classes and mappings abstract class BaseClass { public virtual int
I have an abstract base class and derived class: type TInterfaceMethod = class public
I have an abstract base class with a TcpClient field: public abstract class ControllerBase
If I have a base class such that public abstract class XMLSubscription <T extends

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.