I've written a abstract base class TCPIP sever in its own namespace/library. Currently I have the derived class (more specific TCPIP server; with DataHandler) in the .exe project of the solution.
I'm almost 100% certain this is how I will go, but part of me wants to put the derived class in the base class project. What are some good r...
Intro
Currently I have something of the form:
Tetris class ---> FallingPiece class ----> Piece class
A Piece can be a Square, a T, etc. It has info about its shape and the shapes of its rotations, its size, etc.
The FallingPiece class basically contains an attribute with a reference to a Piece (the currently falling piece in the Te...
My question is about how to design code that works well with object oriented design and asynchronous deferreds (instead of blocking code)
Ok two ways I am thinking about designing the class (are any of these good designs or am I forgetting something)
First Way
class Grooveshark(object):
def get_session(self):
d = # implementation ...
Hi there,
This question is subjective and can reasonably only be answered by those seasoned developers with leadership experience and management personnel with a sound technical proficiency.
For the past year I've pursued educating myself extensively in OOD to become a stronger programmer. In particular, reading and applying knowledge ...
I was wondering about few of the below OOP concepts
1) abstract class cannot have final constructor.
Why cant subclasses have same same constructor without rewriting them
2) abstract method cannot be private .
We can still implement the abstract class in same file. So why not allow this
...
Imagine I have a game with a base Entity class, with an init method that takes no arguments. Now I have a Wizard class, but I want to pass in 2 parameters, say speed and strength. In AS3 (and I believe Java and C#) I will not be allowed to do this - it is an "incompatible override" because the method signatures won't match. Now I could j...
i've been trying my hand at mysqli.
using procedural mysql, the code displays the results fine. however, after making the switch to OOP mysqli, i tried converting the code to mysqli, and it says there are no quotes.
is there anything wrong with the code?
/* the database object */
private $_db;
public function __constr...
I'm still in the learning stages regarding unit-testing and in particular regarding mocking (I'm using the PascalMock and DUnit frameworks). One thing I now stumbled over was that I couldn't find a way around hard-coding implementation details of the tested class/interface into my unit test and that just feels wrong...
For example: I wa...
We've just had a discussion with college about is the following style acceptable for oop or not.
We've a class, which has one public function, and requires a reader in the constructor:
public class Converter
{
private readonly IReader _reader;
public Converter(IReader reader)
{
_reader = reader;
}
public b...
hi all,
I have two classes,In classA I create a variable that I need to use in classB ,
should i use property ?
is there anyone to explain me easier ,how to set StringValue of variable in one class to the textfield of another class?
thanks
...
Hi There,
I have started a new project at work today and a fellow developer has asked me to look into changing the way I work and implementing objects into my views to I can do checks within my view using the object.
To me this seems wrong, as surely this is the work of the Model and/or controller? Or am I wrong? I assume he is wanting...
i'm trying to use mysqli to display data, but it displays nothing.
what is wrong with my code?
php class:
/* the database object */
private $_db;
public function __construct($db=NULL)
{
if(is_object($db))
{
$this->_db = $db;
}
else
{
...
What's the difference between
var myView = function () {
//something goes here
};
and
var myView = function () {
//something goes here
return {
a: x,
b: y
}();
I think the first snippet creates a "dynamic" class, so that you can say
var anotherView = new myView();
and the second snippet is similar to a sing...
I have some object, say son, which I'd like to inherit from another object father.
Of course I can make a constructor function for father, like
Father = function() {
this.firstProperty = someValue;
this.secondProperty = someOtherValue;
}
and then use
var son = new Father();
son.thirdProperty = yetAnotherValue;
but this is not ...
So, I'm learning C++, and I've run into something which I know how to do in Java, but not in C++ :).
I have a template for a container object, which is defined as such:
template <class T>
class Container {
vector<T> contained;
public:
void add(T givenObject) {
this->contained.push_back(givenObject);
}
T g...
I'm experimenting with db4o as a data store, so to get to grips with it I thought I'd build myself a simple issue tracking web application (in ASP.NET MVC). I've found db4o to be excellent in terms of rapid development, especially for small apps like this, and it also negates the need for an ORM.
However, having come from a SQL Server/M...
After wrestling with a bunch of uncaught exceptions when trying to serialize my classes and subclasses, I've finally understood what my problem had been: [Serializable] isn't inherited by subclasses when applied to a base class. I'm still really fuzzy about C# Attributes in general, but I do understand that when creating a custom Attribu...
I've been making "Product Object" for my app and I've been setting attributes, when suddenly I got to price attribute and stumbled upon it with question what type better to choose? I understand, that for PHP it doesn't matter so much, but lets say for MySQL it does.
Any suggestions?
...
My first question: What is the difference between an protected and a public constructor in an abstract class?
My second questions: Does it make sense, if the abstract class has an private constructor?
Thanks in advance!
...
Hello everyone, first post from a newbie-user. Every question I google seems to bring me here and I always get a great answer to what I'm looking for; so naturally this was my first stop when I began pondering the usage of blessing in Perl.
I've just gotten into Perl's OOP and just today read the post asking what bless does. I now under...