I'm trying to extend the DOMDocument class so as to make XPath selections easier. I wrote this piece of code:
class myDOMDocument extends DOMDocument {
function selectNodes($xpath){
$oxpath = new DOMXPath($this);
return $oxpath->query($xpath);
}
function selectSingleNode($xpath){
return $this->selectNodes($xpath)->item(...
I don't want to give an initial value. I want to set these later using the set method
class Duck {
var int id;
var set = Array();
}
Any idea how to declare without getting error?
...
Hi all,
I had an interview days ago and was thrown a question like this.
Q: Reverse a linked list. Following code is given:
public class ReverseList {
interface NodeList {
int getItem();
NodeList nextNode();
}
void reverse(NodeList node) {
}
public static void main(String[] args) {
}
}
I wa...
I am not clear with above statement. It would be great if anybody can explain how we can use inheritance to create a custom, type safe and null safe collection ?
Thanks
...
I am using the excellent jTemplates plugin to generate content.
Given a data object like this...
var data = {
name: 'datatable',
table: [
{id: 1, name: 'Anne'},
{id: 2, name: 'Amelie'},
{id: 3, name: 'Polly'},
{id: 4, name: 'Alice'},
{id: 5, name: 'Martha'}
]
};
..I'm wondering if it is possible to directly specify an ob...
I'm making a small 3d graphics game/demo for personal learning. I know d3d9 and quite a bit about d3d11 but little about opengl at the moment so I'm intending to abstract out the actual rendering of the graphics so that my scene graph and everything "above" it needs to know little about how to actually draw the graphics. I intend to make...
What are possibles designs for implementation of the DCI (data, contexts, interactions) architecture in different OOP languages? I thought of Policy based design (Andrei Alexandrescu) for C++, DI and AOP for Java. However, I also thought about using State design pattern for representing roles and some sort of Template method for the inte...
Well i need some help here i don't know how to solve this problem.
the function of the attribute is to determine if the function can be run...
So what i need is the following:
The consumer of the attribute should
be able to determine if it can be
executed.
The owner of the attribute should be
able to tell the consumer that now it
can...
Basically, I am diving ever deeper into complex programming practices. I've almost no friends that are experienced (or more experienced than me) programmers to learn from, so I am looking for the next best thing - learning from the work of strangers.
Can anyone recommend a real world finished and working application written well and OOP...
Suppose I have the following class:
class Camera
{
public Camera(
double exposure,
double brightness,
double contrast,
RegionOfInterest regionOfInterest)
{
this.exposure = exposure;
this.brightness = brightness;
this.contrast = contrast;
this.regionOfInterest = regi...
Hello. I am no newb on OO programming, but I am faced with a puzzling situation. I have been given a program to work on and extend, but the previous developers didn't seem that comfortable with OO, it seems they either had a C background or an unclear understanding of OO. Now, I don't suggest I am a better developer, I just think that I ...
I 'm devoloping a web page which has multi simalar inputs(lots of dropdownlist,text) grouped by some type selection (for example an imagetype input has some dropdowns,text inputs alse an other type has similar dropdowns ,text inputs also... )
these inputs will be selected over a treenode.
when a node selected,input values of the selected...
i used to create an instance of a singleton class like this:
$Singleton = SingletonClassName::GetInstance();
and for non singleton class:
$NonSingleton = new NonSingletonClassName;
i think we should not differentiate how we create an instance of a class whether this is a singleton or not. if i look in perception of other class, i d...
Do generalization arrows in class diagram has to be strictly open or is there a margin of tolerance on style of this arrows?
...
Making UML sequence diagram in VS 2010RC I've observed that there is no activation rectangle in first object. Is this correct? Not according to my tutor and I have to quote him:
"Finally, you have no activation rectangle for the userInterface instance, so the initial message could never have been sent."
But I'm thinking that if guys fro...
Here is my code:
class Soldier {
public:
Soldier(const string &name, const Gun &gun);
string getName();
private:
Gun gun;
string name;
};
class Gun {
public:
void fire();
void load(int bullets);
int getBullets();
private:
int bullets;
}
I need to call all the member functions of Gun over a Soldier object. Some...
What is the difference between a software development pattern?
A methodology such as agile DSDM etc how is OO classed as a methodology and a paradigm?
How can OO be applied to a methodology such as agile if itself is a methodology?
Whats the difference between a paradigm and a methodology or a development pattern?
Thanks for any re...
Hello,
I'm trying to extend two native PHP5 classes (DOMDocument and DOMNode) to implement 2 methods (selectNodes and selectSingleNode) in order to make XPath queries easier. I thought it would be rather straighforward, but I'm stuck in a problem which I think is an OOP beginner's issue.
class nDOMDocument extends DOMDocument {
pub...
What are the advantages/disadvantages of Option 2 over 1 in this example?
Option 1 (Inheritance):
public class SalesList : List<Sales>
{
//methods that add extra behavior List<Sales>
}
Option 2 (Composition):
public class SalesList
{
private List<Sales> _list;
//methods that add extra behavior to List<Sales>
}
...
I've got a common task that I do with some Activities - downloading data then displaying it. I've got the downloading part down pat; it is, of course, a little tricky due to the possibility of the user changing the orientation or cancelling the Activity before the download is complete, but the code is there. There is enough code handli...