10 Answered Questions for the topic oop

07/19/19

#### What does it mean to "program to an interface"?

I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this? I know what interfaces do, but the fact I am not clear on this makes me think I am... more

07/11/19

#### Interface vs Base class?

When should I use an interface and when should I use a base class? Should it always be an interface if I don't want to actually define a base implementation of the methods?

07/03/19

#### Prefer composition over inheritance?

Why prefer composition over inheritance? What trade-offs are there for each approach? When should you choose inheritance over composition?

06/22/19

#### What's the difference between a method and a function?

Can someone provide a simple explanation of methods vs. functions in OOP context?

06/11/19

#### What are the differences between type() and isinstance()?

What are the differences between these two code fragments?Using type(): import types if type(a) is types.DictType: do_something() if type(b) in types.StringTypes: ... more

05/28/19

#### What is the point of interfaces in PHP?

Interfaces allow you to create code which defines the methods of classes that implement it. You cannot however add any code to those methods. Abstract classes allow you to do the same thing, along... more

05/24/19

#### Calling base class overridden function from base class method?

public class A {  public void f1(String str) {   System.out.println("A.f1(String)");   this.f1(1, str);  }    public void f1(int i, String str) { ... more

05/24/19

#### How would you access Object properties from within an object method?

What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method?I know that from outside of the object you should use a... more

05/14/19

#### What are metaclasses in Python?

What are metaclasses and what do we use them for?

05/10/19

#### Meaning of @classmethod and @staticmethod for beginner?

Could someone explain to me the meaning of @classmethod and @staticmethod in python? I need to know the difference and the meaning. As far as I understand, @classmethod tells a class that... more

## Still looking for help? Get the right answer, fast.

Get a free answer to a quick problem.
Most questions answered within 4 hours.

#### OR

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.