Top "Oop" questions

Object-oriented programming is a programming paradigm using "objects": an encapsulation consisting of data fields and methods together with their interactions.

What is the main difference between Inheritance and Polymorphism?

I was presented with this question in an end of module open book exam today and found myself lost. I …

java oop inheritance polymorphism
Explaining Python's '__enter__' and '__exit__'

I saw this in someone's code. What does it mean? def __enter__(self): return self def __exit__(self, type, value, …

python oop with-statement
What is the difference between __init__ and __call__?

I want to know the difference between __init__ and __call__ methods. For example: class test: def __init__(self): self.a = 10 …

python class oop object callable-object
Polymorphism vs Overriding vs Overloading

In terms of Java, when someone asks: what is polymorphism? Would overloading or overriding be an acceptable answer? I think …

java oop polymorphism overloading overriding
How do I implement interfaces in python?

public interface IInterface { void show(); } public class MyClass : IInterface { #region IInterface Members public void show() { Console.WriteLine("Hello World!"); } #endregion } …

python oop
What exactly is an instance in Java?

What is the difference between an object, instance, and reference? They say that they have to create an instance to …

java oop object reference instance
Functional programming vs Object Oriented programming

I've been mainly exposed to OO programming so far and am looking forward to learning a functional language. My questions …

oop functional-programming paradigms
Print all properties of a Python Class

I have a class Animal with several properties like: class Animal(object): def __init__(self): self.legs = 2 self.name = 'Dog' …

python oop
Can we instantiate an abstract class?

During one of my interview, I was asked "If we can instantiate an abstract class?" My reply was "No. we …

java oop class object abstract
Adding a Method to an Existing Object Instance

I've read that it is possible to add a method to an existing object (i.e., not in the class …

python oop methods monkeypatching