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; }
}
}
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; }
}
}
Comment