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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:49:18+00:00 2026-06-14T20:49:18+00:00

I have common data across different instances of derived classes. So to share the

  • 0

I have common data across different instances of derived classes.
So to share the common data properties, I made them static in base class.
But the static common properties can not be declared in the interface.
If we try, we get the error:

“cannot implement an interface member because it is static.”

Is there any known design pattern or a best practice for this kind of requirement?

  • 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-14T20:49:20+00:00Added an answer on June 14, 2026 at 8:49 pm

    Interface defines just that, an interface. As soon as you have anything “real”, be it method implementation or shared data, you need a class, an abstract one in this case.

    Alternative would be to keep the interface, but add singleton to hold the data related to the classes which implement the interface. If you need to use an interface, then this is the way to go, I think. Just name the singleton so, that it is obvious it’s logically linked to the interface, and document, that implemenations of the interface should use it.

    In your case, static class with the data might be enough, instead of full singleton implementation, but I will not get into this here, the whole “static classes vs singletons” is somewhat controversial subject.

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

Sidebar

Related Questions

I have some common javascript functionality that I want to share across several views/pages.
In my data model I have a fairly common division between my objects/tables/data: Transactional
I have a common data {the logged-in user's message number) to display on every
How to have common NSConnection for various data processing from web server in iPhone.
I have two data structure classes (this is a simplified version of my code)
I have a bunch of data classes in my C# project. I need to
I have two VC++ 6 apps writing/updating data in a common Access 2000 database
I have two files with different data formats in HDFS. How would a job
I have common functionality that I need to access from all screens of my
I have a common validation function function connect_and_update_destination() { var flag = true; //

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.