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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:10:59+00:00 2026-06-14T08:10:59+00:00

Which is generally considered the more preferred method when trying to add a constructor

  • 0

Which is generally considered the more preferred method when trying to add a constructor with an additional parameter? A subclass or a wrapper? That being, creating a subclass of the class and then just using that subclass’ constructor? Or adding a wrapper method which will take the extra parameter and return an object with that parameter set?

Thank you for your time!

EDIT:

I don’t have access to the superclass’s code.

  • 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-14T08:11:00+00:00Added an answer on June 14, 2026 at 8:11 am

    The answer is language dependent. In C#/.NET, you would typically use an overloaded constructor:

    public class Foo 
    {
       private readonly string _greeting;
    
       public Foo() : this("Hello") { }
    
       public Foo(string greeting) {
         _greeting = greeting;
       } 
    
       //...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems to me that some languages are generally being conceived as more beautiful
Does anyone know in which programming language the Googlebot was written? Or, more generally,
I know that using JSP scriptlets is generally frowned upon, which is why I'm
I've been lately trying to learn more and generally test Java's serialization for both
I have an EditText, which generally shows parallel to the screen X-axis. I want
I am currently working on some simple custom allocators in c++ which generally works
I have an animated game which is generally achieving 25-30 frames per second, though
I generally use IoC pattern in my projects which are most of the time
I'm trying to crete a regex which can accept general SQL / Js date
I have a database that has two tables, one of which contains a foreign

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.