Object oriented programming interview questions
Question 1: Why Object Oriented Programming?
Answer: Object-oriented programming helps us think in terms of real-world objects.
Example: Doctor attending the patient, so a particular patient has a doctor
class Patient {
public string name { get; set; }
public string address { get; set; }
public Doctor doctorDetails { get; set; }
}
class Doctor {
public string name { get; set; }
}
Question 2: What are the important pillars in OOP?
Answer:
- Abstraction: Show only what is necessary
- Polymorphism: Objects act differently under different conditions
- Inheritance: Parent-Child relations
- Encapsulation: Hide complexity
Comments
Post a Comment