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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:42:48+00:00 2026-06-04T12:42:48+00:00

I think I have a fairly basic question here. I’m not trying to waste

  • 0

I think I have a fairly basic question here. I’m not trying to waste your time, but I just didn’t know what to Google to get a good answer. My question has to do with object initialization. Take the following example from the Head First C# book:

using System;
using etc...

namespace Bees
{
   public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Queen queenie = new Queen(workers, Report); //Queen is a created class
        }
        Queen queenie; //This is the line I'm curious about

        private void assignButton_Click(object sender, EventArgs e)
        {
            Report.AppendText(queenie.AssignWork(comboBox1.SelectedItem.ToString(), (int)shifts.Value));
        }

        private void button1_Click(object sender, EventArgs e)
        {
            queenie.WorkNextShift();
        }
...

If I’ve already instantiated a Queen object by saying Queen queenie = new Queen(...);, what purpose does the Queen queenie line serve, and what is its scope? What key concept am I misunderstanding here?

  • 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-04T12:42:50+00:00Added an answer on June 4, 2026 at 12:42 pm

    It looks like a bug in the code. Probably this was meant:

    public Form1()
    {
        InitializeComponent();
        queenie = new Queen(workers, Report);
    }
    
    Queen queenie; //This is where the reference to the constructed Queen is stored
    

    The line Queen queenie; declares a field of type Queen that is accessible from all methods of the instance, but not from outside the class.

    If you are uncertain what some of these terms mean, I suggest that you follow a more gentle tutorial:

    • https://stackoverflow.com/questions/4807574/best-c-sharp-programing-books-for-absolute-beginner-or-someone-just-starting-wit

    Or if you already blew your book budget for the year then browse some of the free online documentaition:

    • Classes
    • Objects
    • Fields
    • Members
    • Methods
    • Access Modifiers
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have what I think should be a fairly simple mapping issue, but not
I think I have a basic understanding of REST, but something I'm stuck on
I think the title for this question is probably wrong, but I'm not sure
I think this fairly basic but I can't seem to find one on-line. This
I have what I think should be a fairly simple implementation, but I'm running
I think I have a synchronization problem...It may be too basic..Please help.. I have
I think I have this working but I need advice. I'd like to know
I think i have a basic problem in understanding the dojo toolkit. Well I
I think I have a pretty simple goal but cant seem to reach it.
I am writing a wordpress theme, and have run into a fairly basic problem.

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.