abstract class Shape
{
public abstract double Area(); // Abstract method
public void Display()
{
Console.WriteLine("This is a shape.");
}
}
class Circle : Shape
{
public double Radius { get; set; }
public Circle(double radius)
{
Radius = radius;
}
public override double Area()
{
return Math.PI * Radius * Radius;
}
}
interface IDrawable
{
void Draw(); // Method declaration without implementation
}
interface IResizable
{
void Resize(int width, int height); // Method declaration without implementation
}
class Rectangle : IDrawable, IResizable
{
public void Draw()
{
Console.WriteLine("Drawing a rectangle.");
}
public void Resize(int width, int height)
{
Console.WriteLine($"Resizing to width: {width}, height: {height}");
}
}
static class Logger
{
public static void Log(string message)
{
// Log the message
}
}
// File1.cs
partial class MyPartialClass
{
public void Method1()
{
Console.WriteLine("Method1 from File1");
}
}
// File2.cs
partial class MyPartialClass
{
public void Method2()
{
Console.WriteLine("Method2 from File2");
}
}
// Program.cs
using System;
class Program
{
static void Main()
{
MyPartialClass myObj = new MyPartialClass();
myObj.Method1(); // Output: Method1 from File1
myObj.Method2(); // Output: Method2 from File2
}
}