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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:24:03+00:00 2026-05-11T15:24:03+00:00

I have a situation utilizing class table inheritance where the base object (which is

  • 0

I have a situation utilizing class table inheritance where the base object (which is abstract) is extended by specific types of the object.

For example, Person –> User –> Prospect

However, in some instances like with Prospect, sometimes it extends User and sometimes it doesn’t. I can’t reverse the relationship because User !== Prospect so I’m wondering how to best handle these kinds of scenarios where an object sometimes extends and sometimes doesn’t.

Also, I know that someone will suggest composition over inheritance in this case, but that’s truly not feasible because I’m relying on the ability to extend parent functionality and member properties are populated so that all properties are accessed in the exact same manner.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T15:24:04+00:00Added an answer on May 11, 2026 at 3:24 pm

    Inheritance in a database usually means the primary_key of the child table is a foreign_key to the parent table’s primary_key.
    But you mention the child could be an orphan. In this case the parent is an optional relation. (Usually solved by composition)

    You could create two classes, one extending User and one that doesn’t.

    (But this may not be appropriate for what you are trying to do)

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

Sidebar

Related Questions

I have situation like this: // Object Class class Person_Object { protected $_id; public
I have situation where i have column in mysql table from which i populate
i have situation like this: class IData { virtual void get() = 0; virtual
I have situation in which I read a record from a database. And if
Pseudo-situation: have a class (let's say BackgroundMagic ), and it has Start() and Stop()
I have situation in which i'm compelled to retrieve 30,000 records each to 2
I have situation to extend the Enumerable class in c# to add the new
I have a situation where there is a program which is written in c++.
I have situation where I am mapping table's columns to the primary key of
I have situation where my Java class needs to create a ton of certain

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.