oop Questions
6
Solved
I have a super class with a method that calls other methods that are only defined in its sub classes. That's why, when I create an instance of my super class and call its method, it cannot find the...
Fool asked 3/11, 2011 at 0:37
4
Solved
I have a class as follows:
class MyClass(object):
int = None
def __init__(self, *args, **kwargs):
for k, v in kwargs.iteritems():
setattr(self, k, v)
def get_params(self):
return {'int': ran...
Oistrakh asked 7/5, 2013 at 19:52
41
What is the precise difference between encapsulation and abstraction?
Beachcomber asked 12/4, 2009 at 20:15
4
Solved
So I want to be able to add/remove class methods at runtime. Before you tell me that's horrible pratice in oop, it might be, but I don't really care. The reason I want to be able to do this is beca...
Hoseahoseia asked 20/10, 2009 at 9:35
4
Solved
My level of typescript is 'ABSOLUTE BEGINNER' but I have a good OOP background. I am building an with typescript that reference an external t.ds library that contains the following interface:
inte...
Lipo asked 1/5, 2014 at 16:31
6
Solved
I have a class that accepts a generic type, and I want to override the equals method in a non-awkward way (i.e. something that looks clean and has minimal amount of code, but for a very general use...
10
Solved
Introduction
For Java, Dependency Injection works as pure OOP, i.e. you provide an interface to be implemented and in your framework code accept an instance of a class that implements the defined ...
Superlative asked 28/7, 2015 at 14:10
4
Solved
Is sequential coupling really a bad thing in code?
Although it's an anti-pattern, the only risk I see is calling methods in the wrong order but documentation of an API/class library with this ant...
Polyhymnia asked 26/4, 2010 at 8:51
4
Solved
I'm learning about classes and don't understand this:
class MyClass:
var = 1
one = MyClass()
two = MyClass()
print(one.var, two.var) # out: 1 1
one.var = 2
print(one.var, two.var) # out: 2 1
I...
Shenitashenk asked 5/11, 2021 at 17:9
5
Solved
Is there a way in php to type hint for two different, unrelated interfaces? For example:
interface errorable {
function error($msg);
}
interface recordable {
ssh_for_recorder();
}
class upload...
Growing asked 1/3, 2011 at 22:51
6
I'm currently learning how to build an application with pyqt5 and encountered some problem with closeEvent method, overriden so user gets asked for confirmation by QMessageBox object. It seems work...
10
I am doing coding in oops for uploading image in PHP. But After submit image, it's giving warning
"Header may not contain more than a single header, new line detected"
Below is my function, on wh...
29
Solved
When planning out my programs, I often start with a chain of thought like so:
A football team is just a list of football players. Therefore, I should represent it with:
var football_team = new ...
Magdalenamagdalene asked 11/2, 2014 at 3:1
5
Solved
I'm reaching back to my CLOS (Common Lisp Object System) days for this abstract question.
I'm augmenting the question to clarify:
It appears to me that a Python decorator is sort of like an "ar...
11
Solved
class Sub {
static int y;
public static void foo() {
this.y = 10;
}
}
I understand that this represents the object invoking the method and that static methods are not bound to any object. But...
6
Solved
How does the SOLID "Interface Segregation Principle" differ from "Single Responsibility Principle"?
The Wikipedia entry for SOLID says that
ISP splits interfaces which are very large into small...
Disclaim asked 17/1, 2013 at 21:20
7
Solved
I have a class with both a static and a non-static interface in C#. Is it possible to have a static and a non-static method in a class with the same name and signature?
I get a compiler error when...
2
Solved
I'm looking for how to structure the layer of my app between the presentation layer and the model / business object layer. I see examples using Controller classes and others using Service classes. ...
Guerrilla asked 18/9, 2010 at 2:59
4
It might be a silly question, I appreciate if someone can help me understand it.
Can an interface in C# can have static variables?
If the interface itself need to be static to declare static vari...
8
Solved
One stumbles upon this phrase when reading about design patterns.
But I don't understand it, could someone explain this for me?
Chiffchaff asked 23/4, 2010 at 10:27
6
Solved
It seems there are so many ways to set up a JavaScript application so it is confusing as to which one is correct or best. Are there any difference to the below techniques or a better way of doing t...
Yakut asked 25/7, 2012 at 14:2
5
Solved
I am learning go lang and i was wondering if there is a way to do something like this:
type Foo struct {
...
}
type Bar struct {
Foo
...
}
func getFoo() Foo {
return Bar{...}
}
In an objec...
Fisken asked 31/1, 2016 at 15:11
9
Solved
How can I get the parent class(es) of a Python class?
10
Solved
I've got an Abstract PHP superclass, which contains code that needs to know which subclass its running under.
class Foo {
static function _get_class_name() {
return get_called_class();
//works ...
Henceforward asked 17/8, 2010 at 0:43
14
Solved
Example
I have Person, SpecialPerson, and User. Person and SpecialPerson are just people - they don't have a user name or password on a site, but they are stored in a database for record keeping. ...
Proprietor asked 5/9, 2008 at 12:16
© 2022 - 2024 — McMap. All rights reserved.