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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:05:07+00:00 2026-06-01T21:05:07+00:00

Objects in my open-source toolkit are all based on the class AbstractObject. I want

  • 0

Objects in my open-source toolkit are all based on the class AbstractObject. I want to add a function into AbstractObject which will create and return object of the exact same class.

This is different from cloning, because the property values are not copied. I thought about calling it duplicate but it is confusing when working with ActiveRecord classes (as duplicate would be used to duplicate record, not object).

form2 = form1->createObjectWithSameClass()

Please suggest a single-word (preferably) name for this. I appreciate your time!

  • 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-01T21:05:08+00:00Added an answer on June 1, 2026 at 9:05 pm

    Based on the information here, this sounds like you want another plain object of the same type as a variable in scope, and that type is the only context needed when creating the object.

    In that case, this sounds like a valid case for a Factory instead of a method hanging off of an instance. You could do, perhaps:

    myFactory.create(form1)

    or

    myFactory.create(form1.getClass())
    

    EDIT: this is not a direct answer to your question, but because you are concerned with naming, and therefore I assume with clarity of code, one of the big benefits of a pattern is clarity (everyone knows what a Factory is, so they won’t be confused by whatever name you end up choosing).

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

Sidebar

Related Questions

Is JavaScript an open source programming language? I want to know how some objects
Have a Map which contains objects that I want to keep in sync across
is there any library, code sample, open source project, etc helping me share objects(a
I'm currently working on an open source bundle for Symfony2, and really want it
Are there any open source data streaming products for publishing and subscribing to objects?
I'm working with an open-source CMS that uses some very big multi dimensional arrays/objects.
I'm new to JavaScript and creating classes/objects. I'm trying to wrap an open source
I have an open source library which is designed to support very large collections
Looking for an open source mapping tool. I need to create an interactive map
I am using the open source CMS pimcore ( http://www.pimcore.org ), which runs on

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.