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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:54:32+00:00 2026-05-11T07:54:32+00:00

I am creating an object that has a constuctor like this… public class BusinessLogic()

  • 0

I am creating an object that has a constuctor like this…

public class BusinessLogic() {       public BusinessLogic()       {             BusinessLogicSubClass blsc = new BusinessLogicSubClass(and I want to pass in BusinessLogic here)       } } 

I am doing this because I want BusinessLogicSubClass to call back to varying methods within BusinessLogic when it completes one method or another. BusinessLogicSubClass also uses Constructor Injection in order for my Unit Tests to work with NMock2.

Any suggestions here would be helpful thank you in advance!

  • 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. 2026-05-11T07:54:33+00:00Added an answer on May 11, 2026 at 7:54 am
     public BusinessLogic()   {        BusinessLogicSubClass blsc = new BusinessLogicSubClass(this);   } 

    An alternative to this (to address Jon Skeet’s comments) would be to have a constructor, and an initializer, which uses the ‘this’ pointer:

    public class BusinessLogic  {     private BusinessLogicSubClass blsc = null;      public BusinessLogic() {}      public void Initialize()     {         blsc = new BusinessLogicSubClass(this);     } }  public class Implementor {     public void SomeFunction()     {         BusinessLogic bl = new BusinessLogic();         bl.Initialize();     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I find myself very often creating an object that has no public methods and
I want to get a type of a BasePage object that I am creating.
im creating a Factory class that will contruct and return an object. I normally
I'm creating my own JavaScript Array-like object and I have methods that call closures.
I have an @activity that has_many :clientships When creating a new object I assign
I'm creating a function where I need to pass an object so that it
I am creating an ASP script that uses the application object to store the
I'm creating an email message using CDO object (and VB6, but that doesn't really
I am creating object-detection program on Mac. I want to use iSight in manual
Does creating an object using reflection rather than calling the class constructor result in

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.