Created
February 19, 2022 12:34
-
-
Save charanhu/8416086d70397c73ea2276577a8fd4b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace DLithe | |
{ | |
public class A | |
{ | |
public string Name; | |
public void GetName() // () | |
{ | |
Console.WriteLine("Name: {0}", Name); | |
} | |
} | |
public class B : A | |
{ | |
public string Location; | |
public void GetLocation() | |
{ | |
Console.WriteLine("Location: {0}", Location); // {0} | |
} | |
} | |
public class C : B | |
{ | |
public int Age; | |
public void GetAge() | |
{ | |
Console.WriteLine("Age: {0}", Age); | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
C c = new C(); | |
c.Name = "John Doe"; | |
c.Location = "Hyderabad"; | |
c.Age = 32; | |
c.GetAge(); // Missing calling methods | |
c.GetLocation(); | |
c.GetName(); | |
Console.WriteLine("\nPress Any Key to Exit.."); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment