Skip to content

Instantly share code, notes, and snippets.

@ottok
Created May 1, 2013 19:25
Show Gist options
  • Save ottok/5497666 to your computer and use it in GitHub Desktop.
Save ottok/5497666 to your computer and use it in GitHub Desktop.
JavaScript and C# comparison
class foo {
protected var findMe = 100;
}
class bar extends foo {
class baz extends foo {
public function Constructor() {
console.log("baz: " + findMe);
}
}
public function Constructor() {
findMe = 5;
console.log("bar: " + findMe);
new baz();
}
}
new bar();
class foo {
protected int findMe = 100;
}
class bar : foo {
class baz : foo {
public baz() {
System.Console.WriteLine("baz: " + findMe);
}
}
public bar() {
findMe = 5;
System.Console.WriteLine("bar: " + findMe);
new baz();
}
}
class MainClass {
public static void Main (string[] args) {
bar _bar = new bar();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment