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:

  1. Abstraction: Show only what is necessary
  2. Polymorphism: Objects act differently under different conditions
  3. Inheritance: Parent-Child relations
  4. Encapsulation: Hide complexity

Comments

Popular posts from this blog

Docker Tutorial For Beginners: Basic Commands of Docker

Text Mining In Python For Beginners to Advance

Stock Buy and Sell to earn Maximize Profit programme in Python