473,320 Members | 2,112 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,320 software developers and data experts.

repeated declaration

I have a class where something like this is written:

int declareTwice = 4;
private void testDeclaration()
{
int declareTwice = 5;
}

Why am I allowed to create a second variable 'declareTwice'? I'd expect the
compiler to say: 'declareTwice already declared'. What's the use of allowing
this? I would think it only makes people make mistakes... Does the second
declareTwice hide the first one within its scope?

Thanks for any help.
Nov 16 '05 #1
0 763

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Leif K-Brooks | last post by:
How do I make a regular expression which will match the same character repeated one or more times, instead of matching repetitions of any (possibly non-same) characters like ".+" does? In other...
0
by: Wolfgang Lipp | last post by:
From: Lipp, Wolfgang Sent: Tuesday, 27?January?2004 13:26 <annotation> the first eleven contributions in this thread started as an off-list email discussion; i have posted them here with...
15
by: Robert Sturzenegger | last post by:
// Code sequence A for (int i = 0; i < 10; ++i) { int k = something(); // some more code which uses k } // Code sequence B int k; for (int i = 0; i < 10; ++i) { k = something();
2
by: RingTone | last post by:
SQL Server 2000/Access 2000 linked tables PK = FLOOR/DESK NO/TYPE A User has complained about seeing data below simply by scrolling through the attached table, the data is there when you look at...
1
by: Alec MacLean | last post by:
Hi, Outline of problem: I've built a set of user controls that are used to output questions for a survey and gather the responses using simple radio buttons. I'm adding an optional textbox...
3
by: IraqiAli | last post by:
ok i have a couple of textboxes. The user is required to input values from 1 to 6 into those boxes. and submit it, those values would then go into an array. What i need to do is do checks to make...
7
by: bagelman | last post by:
Hi, I have a string Array. Its length is 100. I want to search the array to find repeated strings in it. And after finding repeated strings I want to write to screen which word repeated how many...
7
by: mcha226 | last post by:
Hi All I have to build a page which includes a select element (as a drop down menu) with all the country names in it. However I just found out that the need to be repeated many times so the...
19
by: RossGK | last post by:
I'm a bit new to javascript - as will be obvious below. I'm using an XMLHttpRequest to get a bit of data from server (django), and it works nicely for single events. But my eventual outcome...
9
by: C#_Help_needed | last post by:
I need help with the following question. THANKS :) Write a program in c# that takes in a directory as a command line parameter, and returns the longest repeated phrase in ALL text files in that...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.