The question of why there are no friends in C# has been extensively discussed.
I have the following design problem.
I have two classes TradingSystem and Order.
TradingSystem class has only one public function AddOrder(Order ord). Clients are allowed to call only this function. All other logic must be hidden. Order class is listening to...
I want to model a kind of FSM(Finite State Machine). I have a sequence of states (let's say, from StateA to StateZ). This sequence is called a Chain and is implemented internally as a List. I will add states by the order I want them to run.
My purpose is to be able to make a sequence of actions in my computer (for example, mouse clicks)...
Hello
Is it bad habit to work with multiple models in one controller action?
Should it always be like one controller-one model-one view?
...
I'd like to know how people decide whether to define a method as static. I'm aware that a method can only be defined as static if it doesn't require access to instance fields. So let's say we have a method that does not access instance fields, do you always define such a method as static, or only if you need to call it statically (withou...
Hi,
I have a flash project with three non overlapping panels (visual spaces) each of which contains different movie-clips. Each movie-clip in a particular panel is the child of that panel.
Now, I want to drag one of the movie-clips from one panel to another (remove it as a child from the first panel and add it to the other) without a ...
Hi!
How can I call parents constructor ?
module C
attr_accessor :c, :cc
def initialization c, cc
@c, @cc = c, cc
end
end
class B
attr_accessor :b, :bb
def initialization b, bb
@b, @bb = b, bb
end
end
class A < B
include C
attr_accessor :a, :aa
def initialization (a, b, c, aa, bb, ...
The below is a typical, for me, Update method in L2S. I am still fairly new to a lot of this(L2S & business app development) but this just FEELs wrong. Like there MUST be a smarter way of doing this. Unfortunately, I am having trouble visualizing it and am hoping someone can provide an example or point me in the right direction.
To t...
It seemed like this question should have been asked before, but searching found nothing.
I've always wondered what's the point of making us put every bit of code inside a class or interface. I seem to remember that there were some advantages to requiring a main() function like C, but nothing for classes. Languages like Python are, in a ...
What is the best way to model MVC Areas for my Application? Can I manage these Areas dynamically? What is the best usage of them?
Thanks
...
The problem:
class StatesChain : IState, IHasStateList {
private TasksChain tasks = new TasksChain();
...
public IList<IState> States {
get { return _taskChain.Tasks; }
}
IList<ITask> IHasTasksCollection.Tasks {
get { return _taskChain.Tasks; } <-- ERROR! You can't do this in C#!
...
i've got a lot of functions i create or copy from the web.
i wonder if i should store them in a file that i just include into the script or should i store each function as a static method in a class.
eg. i've got a getCurrentFolder() and a isFilePhp() function.
should they be stored in a file as they are or each in a class:
Folder::g...
I dont know much about classes, but have a reasonable knowledge of PHP/MySQL.
But why should I learn classes? I know they are important but what benefits can I see using them that I cant with?
...
in java you can create an object directly after the property field like this:
but it seems not working for php:
class Test {
public $object = new Object();
}
you have to create it in the __construct() and assign it to the property?
thanks
...
I need to maintain a list of userids (proxy accounts) which will be dished out to multithreaded clients. Basically the clients will use the userids to perform actions; but for this question, it is not important what these actions are. When a client gets hold of a userid, it is not available to other clients until the action is completed....
I'm trying to write some abstract code for searching through a list of similar objects for the first one whose attributes match specific values. In order to do this, I need to call a bunch of accessor methods and check all their values one by one. I'd like to use an abstraction like this:
sub verify_attribute {
my ($object, $attribu...
I am working on an import / export program that can export content from a CMS into a XML structure which then can also be reimported into the CMS in order to update the content.
Yesterday I came up with a prototype by some explorative coding. The functionality is there, the program works as expected. But the functionality basically con...
In OOP modeling, is there any distinction between a "has-a" relationship and a "composed-of" relationship?
...
Requirements:
multiple sources of input (social media content) into a system
multiple destinations of output (social media api's)
sources and destinations WILL be added
some pseudo:
IContentProvider contentProvider = context.getBean("contentProvider");
List<Content> toPost = contentProvider.getContent();
for (Content c : toPost) {
...
I'm creating class library with some commonly used classes like persons, addresses etc. This library will be used in an multilingual application, and I am looking for the most convenient way to represent a persons gender.
Ideally I would like to be able to code like this:
Person person = new Person { Gender = Genders.Male,
...
hi, this is a simple OOP QT question.
my app consists of main window (QMainWindow) and a table (QTableWidget).
in the main window i have arguments and variables which i would like to pass to the table class, and to access methods in main widnow class from the table class, how should i do it ?
mainwindow.h
class MainWindow : public QMai...