Skip to content

Instantly share code, notes, and snippets.

@charanhu
Created February 19, 2022 12:34
Show Gist options
  • Save charanhu/8416086d70397c73ea2276577a8fd4b8 to your computer and use it in GitHub Desktop.
Save charanhu/8416086d70397c73ea2276577a8fd4b8 to your computer and use it in GitHub Desktop.
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