public void ChildClassExplicitParentClassNewMethod() { NewAndOverrideClasses.ParentClass childClass = new NewAndOverrideClasses.ChildClassNew(); System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(childClass.SayHelloWorld()); }
public void ChildClassWithNewMethodCallingHelperMethod() { var childClass = new NewAndOverrideClasses.ChildClassNew(); System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(childClass.CallMethodToSayHelloWorld()); }
public void ChildClassWithNewMethodCallingHelperMethod() { var childClass = new NewAndOverrideClasses.ChildClassNew(); System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(childClass.CallMethodToSayHelloWorld()); }
public void ChildClassExplicitParentClassNewMethod() { NewAndOverrideClasses.ParentClass childClass = new NewAndOverrideClasses.ChildClassNew(); System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(childClass.SayHelloWorld()); }
public void UsingDynamic() { NewAndOverrideClasses.ParentClass parentType = new NewAndOverrideClasses.ChildClassNew(); dynamic childType = parentType; System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(childType.SayHelloWorld() as string); }
public void DeclareAndUseImplicitTypeDeclaration() { NewAndOverrideClasses.ParentClass parentType = new NewAndOverrideClasses.ChildClassNew(); var childType = parentType; System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine("Parent variable"); System.Diagnostics.Debug.WriteLine(parentType.SayHelloWorld()); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine("Child variable"); System.Diagnostics.Debug.WriteLine(childType.SayHelloWorld()); }
public void DeclareAndChangeVariableType() { NewAndOverrideClasses.ChildClassNew childClass = new NewAndOverrideClasses.ChildClassNew(); NewAndOverrideClasses.ParentClass newChildClass = childClass; System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine("Child variable"); System.Diagnostics.Debug.WriteLine(childClass.SayHelloWorld()); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine("Parent variable"); System.Diagnostics.Debug.WriteLine(newChildClass.SayHelloWorld()); }
public void DeclareAndChangeVariableType() { NewAndOverrideClasses.ChildClassNew childClass = new NewAndOverrideClasses.ChildClassNew(); NewAndOverrideClasses.ParentClass newChildClass = childClass; System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine("Child variable"); System.Diagnostics.Debug.WriteLine(childClass.SayHelloWorld()); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine("Parent variable"); System.Diagnostics.Debug.WriteLine(newChildClass.SayHelloWorld()); }
public void UsingDynamic() { NewAndOverrideClasses.ParentClass parentType = new NewAndOverrideClasses.ChildClassNew(); dynamic childType = parentType; System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(childType.SayHelloWorld() as string); }
public void DeclareAndUseImplicitTypeDeclaration() { NewAndOverrideClasses.ParentClass parentType = new NewAndOverrideClasses.ChildClassNew(); var childType = parentType; System.Diagnostics.Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine("Parent variable"); System.Diagnostics.Debug.WriteLine(parentType.SayHelloWorld()); System.Diagnostics.Debug.WriteLine(""); System.Diagnostics.Debug.WriteLine("Child variable"); System.Diagnostics.Debug.WriteLine(childType.SayHelloWorld()); }