Hi, this is Oben from Turkey.
I work for my homework in C++ and i have some problems with multiply definitions.
My graph class ;
class Graph{
private:
string name; //Graph name
fstream* graphFile; //Graph's file
protected:
string opBuf; ...
I have one Sell Operation object and two Buy Operation objects, i want to implement such behavior that one Sell Operation discharges two Buy Operation, it looks like:
sellOperation.Discharge(oneBuyOperation);
sellOperation.Discharge(twoBuyOperation);
so i want to ask whether i should call the repository function in the Discharge me...
Hi
From my understanding partial classes are a bit frowned upon by professional developers, but I've come over a bit of an issue;
I have made an implementation of the RichTextBox control that uses user32.dll calls for faster editing of large texts. That results in quite a bit of code. Then I added spellchecking capabilities to the cont...
i'm trying to follow DRY and i've got some functions i have to reuse.
i put them all as static functions in a class and want to use them in another class.
what is the best way to make them available to a class.
cause i can't extend the class, its already extended.
should/could i use composition?
what is best practice?
thanks!
...
I have a requirement to use a Fund model in my code. It will contain a fund name and fund code. In the interest of reuse I've poked around the package containing the other models used and found an existing Fund model. However the issue here is that, in addition to fund name and code, it also contains an amount. Amount isn't directly ...
Hello,
I am writing a method that will set the properties of an object passed as a parameter. The method accepts one parameter of type interface and the return type of the method is the same interface. I was wondering if there is some kind of a naming convention for such methods. I was thinking of something like:
FillInInterfaceTypeDat...
At the moment I have this code (and I don't like it): private RenderedImage
private RenderedImage getChartImage (GanttChartModel model, String title,
Integer width, Integer height,
String xAxisLabel, String yAxisLabel,
Bool...
I know of class-based and protype based object oriented programming languages, are there any other alternatives? What are they?
...
Let's assume I have a c++ class that have properly implemented a copy constructor and an overloaded = operator. By properly implemented I mean they are working and perform a deep copy:
Class1::Class1(const Class1 &class1)
{
// Perform copy
}
Class1& Class1::operator=(const Class1 *class1)
{
// perform copy
return *this;
}
Now l...
I want to improve my JavaScript so I thought it'd be a good idea to get a book on Object Oriented JavaScript. But I also use a lot of jQuery so I'm looking for a book that approached OO JavaScript from a jQuery point of view
...
Please note: I am writing this question.
I have these interfaces in a library/framework I am working on:
interface IRepository<TKey,TModel> where TModel: IModel<TKey>{
void Remove(TModel entity);
}
interface IRepository<T> : IRepository<int, T> where T: IModel { }
interface ISoftDeleteRepository<TKey,TModel> : IRepository<TKey, ...
Is there a way to do this in C#? I know that the subclass will call the superclass constructor before calling its own constructor, but what If I have some code on the superclass that should only be executed after all the subclasses constructors have been called?
...
Getters and Setters are bad
Briefly reading over the above article I find that getters and setters are bad OO design and should be avoided as they go against Encapsulation and Data Hiding. As this is the case how can it be avoided when creating objects and how can one model objects to take this into account.
In cases where a getter or ...
I've never seen this done but I had an idea of doing authorization in a more purely OO way. For each method that requires authorization we associate a delegate. During initialization of the class we wire up the delegates so that they point to the appropriate method (based on the user's rights). For example:
class User
{
private dele...
I hope this question takes a simple fix, and I am just missing something very small.
I am in my second semester of C++ in college, and we are just getting into OOP. This is my first OOP program, and it is causing me a little problem. Here are the errors I am getting:
Member function must be called or its address taken in function displ...
1. Passing configuration to the __init__ method which calls register implicitely:
class Base:
def __init__(self, *verbs):
if not verbs:
verbs = "get", "post"
self._register(verbs)
def _register(self, *verbs):
pass
class Sub(Base):
def __init__(self):
super().__init__("get", "pos...
I'm building a Rails site that, among other things, allows users to build their own recipe repository. Recipes are entered either manually or via a link to another site (think epicurious, cooks.com, etc). I'm writing scripts that will scrape a recipe from these sites given a link from a user, and so far (legal issues notwithstanding) t...
whenever i use a open source library eg. Doctrine i always ending up coding a class (so called Facade) to use the Doctrine library.
so next time i want to create a user i just type:
$fields = array('name' => 'peter', 'email' => '[email protected]');
Doctrine_Facade::create_entity($entity, $fields);
then it creates an entity with the ...
Hello !
I am working right now with Zend Framework and I've created a Model_User_Row in app\models\User\Row.php.
When I try to create an instance of that class in IndexController I get an error:
Fatal error: Cannot redeclare class Model_User_Row in
F:\Projekty\www\inz\app\models\User\Row.php on line 14
14th line is a close brace.
<...
I am trying to figure out how to keep my page variables in my application from being defined globally. I've come up with a few methods but am wondering if there is a general standard approach people use.
I've got my plugin design pattern down using this approach: http://www.virgentech.com/blog/2009/10/building-object-oriented-jquery-plu...