Maybe I don't know all the c# quirks, but the code below should be compiling, but it does. See the bolded code at the bottom.
using System;
namespace ConsoleApplicat ion19
{
class Class1
{
&nb sp; [STAThread]
&nb sp; static void Main(string[] args)
&nb sp; {
&nb sp; &nb sp; Child child = new Child();
&nb sp; &nb sp; Console.W riteLine(child. SomeVariable.To String());
&nb sp; }
}
public class MyBase
{
&nb sp; public int SomeVariable;
}
public class Child : MyBase
{
&nb sp; public Child()
&nb sp; {
&nb sp; &nb sp; base.Some Variable = 1;
&nb sp; &nb sp; &nb sp; &nb sp; // why in the world does this compile???
&nb sp; &nb sp; // note the space between the base and .SomeVariable
&nb sp; &nb sp; base .SomeVariable = 2;
&nb sp; }
}
} 11 1589
Frank Rizzo <no**@none.comw rote:
[-- text/html, encoding 7bit, charset: ISO-8859-1, 44 lines --]
I don't know, as you posted HTML in a text newsgroup. Please repost you
question in a format appropriate to the forum.
Thank you.
--
Thomas T. Veldhouse
Key Fingerprint: 2DB9 813F F510 82C2 E1AE 34D0 D69D 1EDC D5EC AED1
Frank,
There is nothing in the specification that says that the period has to
come as the character right after the expression and before the
property/method. You can have as many spaces as you want.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Frank Rizzo" <no**@none.comw rote in message
news:OU******** ********@TK2MSF TNGP06.phx.gbl. ..
Maybe I don't know all the c# quirks, but the code below should be
compiling, but it does. See the bolded code at the bottom.
using System;
namespace ConsoleApplicat ion19
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Child child = new Child();
Console.WriteLi ne(child.SomeVa riable.ToString ());
}
}
public class MyBase
{
public int SomeVariable;
}
public class Child : MyBase
{
public Child()
{
base.SomeVariab le = 1;
// why in the world does this compile???
// note the space between the base and .SomeVariable
base .SomeVariable = 2;
}
}
}
Thomas T. Veldhouse wrote:
Frank Rizzo <no**@none.comw rote:
>[-- text/html, encoding 7bit, charset: ISO-8859-1, 44 lines --]
I don't know, as you posted HTML in a text newsgroup. Please repost you
question in a format appropriate to the forum.
Sorry. I was having line overruns, which is why I posted it in html.
Here is the fixed up version.
using System;
namespace ConsoleApplicat ion19
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Child child = new Child();
Console.WriteLi ne(child.SomeVa riable.ToString ());
}
}
public class MyBase
{
public int SomeVariable;
}
public class Child : MyBase
{
public Child()
{
base.SomeVariab le = 1;
// why in the world does this compile???
// note the space between the base and .SomeVariable
base .SomeVariable = 2;
}
}
}
>
Thank you.
"Frank Rizzo" <no**@none.comw rote in message
news:ec******** ********@TK2MSF TNGP03.phx.gbl. ..
base.SomeVariab le = 1;
// why in the world does this compile???
// note the space between the base and .SomeVariable
base .SomeVariable = 2;
Why wouldn't it compile? Are you attributing some mystical significance to
the white space...?
Because C# certainly doesn't...
Frank Rizzo <no**@none.comw rote:
Thomas T. Veldhouse wrote:
Frank Rizzo <no**@none.comw rote:
[-- text/html, encoding 7bit, charset: ISO-8859-1, 44 lines --]
I don't know, as you posted HTML in a text newsgroup. Please repost you
question in a format appropriate to the forum.
Sorry. I was having line overruns, which is why I posted it in html.
Here is the fixed up version.
<snip>
// why in the world does this compile???
// note the space between the base and .SomeVariable
base .SomeVariable = 2;
Whitespace like that is fine. It's not uncommon to see:
x.DoSomething()
.DoSomethingEls e()
.AndSomethingEl se()
In particular, that's often seen with strings:
x = x.Trim()
.Replace ("\r", "\\r")
.Replace ("\n", "\\n");
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jon Skeet [C# MVP] wrote:
Frank Rizzo <no**@none.comw rote:
>Thomas T. Veldhouse wrote:
>>Frank Rizzo <no**@none.comw rote: [-- text/html, encoding 7bit, charset: ISO-8859-1, 44 lines --]
I don't know, as you posted HTML in a text newsgroup. Please repost you question in a format appropriate to the forum.
Sorry. I was having line overruns, which is why I posted it in html. Here is the fixed up version.
<snip>
> // why in the world does this compile??? // note the space between the base and .SomeVariable base .SomeVariable = 2;
Whitespace like that is fine. It's not uncommon to see:
x.DoSomething()
.DoSomethingEls e()
.AndSomethingEl se()
This doesn't compile on my box.
>
In particular, that's often seen with strings:
x = x.Trim()
.Replace ("\r", "\\r")
.Replace ("\n", "\\n");
This does.
>
Frank Rizzo wrote:
Jon Skeet [C# MVP] wrote:
>Frank Rizzo <no**@none.comw rote:
>>Thomas T. Veldhouse wrote: Frank Rizzo <no**@none.comw rote:
>Whitespace like that is fine. It's not uncommon to see:
x.DoSomething() .DoSomethingEls e() .AndSomethingEl se()
This doesn't compile on my box.
Never mind, I misunderstood you. It, of course, compiles just fine.
Er.....who cares? The fact is it does, at a guess the compiler reads the
line and looks for the next character finds a '.' reads it as a combined
line and sees no issues.
i cant believe you are wasting your own time posting this and anybody elses
to ask such a question?
"Frank Rizzo" <no**@none.comw rote in message
news:OU******** ********@TK2MSF TNGP06.phx.gbl. ..
Maybe I don't know all the c# quirks, but the code below should be
compiling, but it does. See the bolded code at the bottom.
using System;
namespace ConsoleApplicat ion19
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Child child = new Child();
Console.WriteLi ne(child.SomeVa riable.ToString ());
}
}
public class MyBase
{
public int SomeVariable;
}
public class Child : MyBase
{
public Child()
{
base.SomeVariab le = 1;
// why in the world does this compile???
// note the space between the base and .SomeVariable
base .SomeVariable = 2;
}
}
}
Daniel wrote:
Er.....who cares? The fact is it does, at a guess the compiler reads the
line and looks for the next character finds a '.' reads it as a combined
line and sees no issues.
i cant believe you are wasting your own time posting this and anybody elses
to ask such a question?
"Frank Rizzo" <no**@none.comw rote in message
news:OU******** ********@TK2MSF TNGP06.phx.gbl. ..
Maybe I don't know all the c# quirks, but the code below should be
compiling, but it does. See the bolded code at the bottom.
using System;
namespace ConsoleApplicat ion19
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Child child = new Child();
Console.WriteLi ne(child.SomeVa riable.ToString ());
}
}
public class MyBase
{
public int SomeVariable;
}
public class Child : MyBase
{
public Child()
{
base.SomeVariab le = 1;
// why in the world does this compile???
// note the space between the base and .SomeVariable
base .SomeVariable = 2;
}
}
}
That's a bit snide. Any developer who didn't know that may be saved
time debugging someone elses code who did know it just by reading this
thread. Second any curiosity is good and should be encouraged. Third,
this works in C# but not in VB.net so for anyone converting from one to
the other, it would be confusing.
If I had to recruit either you or the OP I'd go with the OP simply
because he's curious and seeks a deeper understanding of his subject
which will serve him well in the future. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike |
last post by:
I am sure that I am making a simple boneheaded mistake and I would
appreciate your help in spotting in. I have just installed
apache_2.0.53-win32-x86-no_ssl.exe
php-5.0.3-Win32.zip
Smarty-2.6.7.tar.gz
on a system running WindowsXP SP2.
Apache and PHP tested out fine. After adding Smarty, I ran the
following http://localhost/testphp.php
|
by: Douglas |
last post by:
**** Post for FREE via your newsreader at post.usenet.com ****
Hello,
The following code does not compile if line 3 is uncommented "using
namespace std".
I do not understand it. Could somebody explain it to me? I am using MSVC
6.0.
Thanks a lot,
|
by: Alex Vinokur |
last post by:
Compiler GNU gpp.exe (GCC) 3.4.1
Foo(300) = Foo(500); // Foo(300) is const. Why does a compiler compile that?
------ foo.cpp ------
struct Foo
{
explicit Foo(int) {}
|
by: Genboy |
last post by:
My "VIS" Website, which is a C# site created in VS.NET, Framework 1.1,
is no longer compiling for me via the command line.
As I have done 600 times in the last year and a half, I can compile to
VIS.DLL via Visual Studio, with no problems:
------ Rebuild All started: Project: VIS,
Configuration: Debug .NET ------
Preparing resources...
Updating references...
|
by: Jason Huang |
last post by:
Hi,
Would someone explain the following coding more detail for me? What's the
( ) for?
CurrentText = (TextBox)e.Item.Cells.Controls;
Thanks.
Jason
| |
by: ziman137 |
last post by:
Hi all,
The results from following codes got me a bit confused.
#include <stdio.h>
#include <iostream>
using namespace std;
struct A {
|
by: Bob Jones |
last post by:
Here is my situation:
I have an aspx file stored in a resource file. All of the C# code is
written inline via <script runat="server"tags. Let's call this page
B. I also have page A that contains some javascript code that calls
window.open. I pass the resource url of page B to Page A's window.open
call. Page B is then loaded and executed but none of the server-side
code is rendered. If I view the source of the page, the code (and page...
|
by: Zytan |
last post by:
I see that static is more restricted in C# than in C++. It appears
usable only on classes and methods, and data members, but cannot be
created within a method itself. Surely this is possible in C# in some
way? Or maybe no, because it is similar to a global variable (with its
scope restricted) which C# is dead against?
Zytan
|
by: MonkeeSage |
last post by:
A quick question about how python parses a file into compiled
bytecode. Does it parse the whole file into AST first and then compile
the AST, or does it build and compile the AST on the fly as it reads
expressions? (If the former case, why can't functions be called before
their definitions?)
Thanks,
Jordan
|
by: Jeff |
last post by:
hi
asp.net 2.0
I get this compile error:
'Image' does not contain a definition for 'ImageUrl'
Image image = (Image)e.Item.FindControl("img");
image.ImageUrl = "~/image.png";
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |