Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Feature Abstract Class Interface Implementation Can have full/partial implementation Cannot have full implementation (except default methods in C# 8+) Fields Can have fields Cannot have fields Inheritance S…
Short answer: High-level modules should not depend on low-level modules. Both should depend on abstractions. Interfaces allow decoupling and easier testing. interface ILogger { void Log(string message); } Example code cl…
Short answer: ffect it? Derived classes should be replaceable by base class without affecting correctness. Inheritance violating this principle can cause unexpected behavior. Real-world example (ShopNest) ShopNest has a…
Short answer: Derived classes should be replaceable by base class without affecting correctness. Inheritance violating this principle can cause unexpected behavior. Real-world example (ShopNest) ShopNest has a base Payme…
Short answer: Duck typing: "If it looks like a duck and quacks like a duck, it is a duck." Behavior is based on method/property availability, not type inheritance. C# does not support full dynamic duck typing,…
Short answer: Allows interfaces to provide default method implementations. Reason: Enables adding new methods to interfaces without breaking existing implementations. interface IPrinter Example code { void Print(string m…
C# OOP C# Programming Tutorial · OOP
Short answer: Feature Abstract Class Interface Implementation Can have full/partial implementation Cannot have full implementation (except default methods in C# 8+) Fields Can have fields Cannot have fields Inheritance Single class inheritance Multiple interface inheritance allowed Constructors Allowed Not allowed Access Modifiers Can have public, protected, private Members are public by default
Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.
C# OOP C# Programming Tutorial · OOP
Short answer: High-level modules should not depend on low-level modules. Both should depend on abstractions. Interfaces allow decoupling and easier testing. interface ILogger { void Log(string message); }
class FileLogger : ILogger { public void Log(string message) => Console.WriteLine("File: " + message); } class UserService
{
private readonly ILogger _logger;
public UserService(ILogger logger) { _logger = logger; }
}
Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.
C# OOP C# Programming Tutorial · OOP
Short answer: ffect it? Derived classes should be replaceable by base class without affecting correctness. Inheritance violating this principle can cause unexpected behavior.
ShopNest has a base PaymentMethod with virtual decimal Fee(). UpiPayment and CardPayment override the fee logic without changing the checkout caller.
C# OOP C# Programming Tutorial · OOP
Short answer: Derived classes should be replaceable by base class without affecting correctness. Inheritance violating this principle can cause unexpected behavior.
ShopNest has a base PaymentMethod with virtual decimal Fee(). UpiPayment and CardPayment override the fee logic without changing the checkout caller.
C# OOP C# Programming Tutorial · OOP
Short answer: Duck typing: "If it looks like a duck and quacks like a duck, it is a duck." Behavior is based on method/property availability, not type inheritance. C# does not support full dynamic duck typing, but interfaces enable a similar concept by relying on contract-based behavior. Dynamic types in C# (dynamic) can also simulate duck typing. interface IFlyable { void Fly(); }
void MakeItFly(IFlyable obj) => obj.Fly(); // Any object implementing IFlyable works
Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.
C# OOP C# Programming Tutorial · OOP
Short answer: Allows interfaces to provide default method implementations. Reason: Enables adding new methods to interfaces without breaking existing implementations. interface IPrinter
{ void Print(string msg); void PrintInfo(string msg) => Console.WriteLine("Info: " + msg); // Default }
Checkout calls IPaymentGateway.Charge(). Razorpay and Stripe adapters implement the same interface, so ShopNest can switch gateways without rewriting the order service.
Install Toolliyo like an app Free
Home-screen access to tutorials, coding practice & career tools — no app store needed.
On iPhone/iPad: tap Share then Add to Home Screen.