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 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

When creating a new entity object that has a foreign key value I need
I find myself very often creating an object that has no public methods and
I'm creating a class (say, C) that associates data (say, D) with an object
I'm looking for a way to create a class that has a default public
I am creating a flash object that does some heavy image lifting. What I
When creating methods, should every object instantiated inside that method be passed in as
I have a class that has only one function Print() and two properties age,
Just assume I have some class Foo, that has two dependencies: an ISerializer<T> and
For the purposes of interoperability with Java, I need a class that has a
I may be going about this backwards... I have a class which is like

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.