Skip to main content

What is inheritance?

Entry .NET Core
Quick Answer Inheritance lets a class (child) reuse and extend the behavior of another class (parent). The child inherits all public and protected members รขโ‚ฌโ€ no need to duplicate code. In C#: class Dog : Animal { }. Dog gets Animal's properties and methods automatically. Use it for "is-a" relationships: a Dog IS an Animal. Prefer composition over deep inheritance hierarchies.

Answer

One class derives behavior from another using 

class Dog : Animal { }


S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice