473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Help please... instance reference; qualify it with a type name instead

Hi:
I have 3 class/Methods:
the first one:just beeps
the second one:ask the user to Enter the number of beep
The last one:Activate and runs.
I get the following Error:"instance reference; qualify it with a type name instead "
Can you please re-write the code and fix it for me,Thanks.

First One:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. public class AmbulanceSiren
  3. {
  4.  
  5.     public void Siren(int pattern)
  6.     {
  7.         for (int i=0;i< pattern; i++)
  8.         {
  9.             Console.Beep();
  10.             Console.Write("");
  11.         }
  12.         }
  13. }
  14.  
Second One:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. public class User
  3. {
  4.  
  5.     public static void Enter()
  6.     {
  7.         Console.WriteLine("Enter The Pattern:");
  8.         AmbulanceSiren Test = new AmbulanceSiren();
  9.         int repeat = Convert.ToInt32(Console.ReadLine());
  10.         Test.Siren(repeat);
  11.  
  12.     }
  13. }
  14.  
Last One:
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. public class Driver
  3. {
  4.  
  5.     public static void Main(string[] args)
  6.     {
  7.         User Active = new User();
  8.  
  9.         Active.Enter();
  10.     }
  11. }
  12.  
Feb 18 '09 #1
2 4807
tlhintoq
3,525 Expert 2GB
Can you please re-write the code and fix it for me,Thanks.
Asking someone else to do your homework (or thinking) (or debugging) for you doesn't teach you anything.

You didn't even mention where the error occurred. Visual Studio should have given you a line number for it.
Feb 19 '09 #2
vekipeki
229 Expert 100+
Well, it looks like Active.Enter(); will throw that error, because Enter() is a static method, while Active is an instance of User class. There is also no reason why you couldn't make AmbulanceSiren.Siren() static.

You should consider giving your classes names that are meaningful, because Active.Enter(); doesn't really tell you anything about what that method does, or what functionality is enclosed in that class.
Feb 20 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: James Walker | last post by:
Can some one help I get an error of 'checkIndate' is null or not an object can someone please help. I can't work out why Thanks in advance James <form> <td height="24" colspan="7"...
6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
8
by: inkexit | last post by:
I am a very amatuer c++ programmer and a somewhat accomplished composer. I am trying to write some code that creates 'self similar' melodies from a base melody the user inputs. This musical idea...
2
by: andrew | last post by:
C:\Documents and Settings\watts\My Documents\Visual Studio Projects\boeing\showPMACfg\vuePMAcfg\vuePMAcfg.cs(88): Static member 'vuePMAcfg.pmaDataHash.pmaDataHash1' cannot be accessed with an...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
4
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I...
14
by: anju458 | last post by:
Hi, I had a function to compare two XML files within a project . Now I need to change that into a commandline exe in such a way that it whouls accept two params from the Command line. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.