Hi,
I have a class as follows :-
interface IFilterCondition
{
List<Name> ApplyFilter(List<Name> namesToFilter);
}
class FilterName : IFilterCondition
{
public NameFilterEnum NameFilterEnum{ get; set; }
public List<Name> ExcludeList { get; set; }
public char StartCharacter{ get; set; }
#region IFilterCondition Me...
Hi all,
I currently have service classes that look something like this
public class UserService : IUserService
{
private IAssignmentService _assignmentService;
private ILocationService _locationService;
private IUserDal _userDal;
private IValidationDictionary _validationDictionary;
public UserService(IAssignmentSer...
Is it possible to return a class through it's own function, so you can chain functions like below:
class Foo;
Foo.setX(12).setY(90);
Can anyone confirm if this is possible, and how it would be achieved?
...
I'm building a basic CRUD library, that I anticipate use in both local (add reference) and wcf (add service reference) environments.
What are the best return types for the Create, Uupdate, and Delete portions (that have more complex business rules) of a CRUD setup?
I want to be able to minimize back-and-forth on the wire, but I also wa...
What advice/suggestions/guidance would you provide for designing a class that has upwards of 100 properties?
Background
The class describes an invoice. An invoice can have upwards of 100 attributes describing it, i.e. date, amount, code, etc...
The system we are submitting the invoice to uses each of the 100 attributes and is submitte...
Which one is better:
I have a class "User" and "Profile". in "User" I'll have a property that will be associated with the "Profile". The two classes will be stored in two different tables "Users" and "Profiles". In table "Profiles" there will be foreign key to "Users" table".
In my "User" class, should I include a property of type "Pr...
I'm running up against a problem in understanding the CLOS way of handling file access within a class. In c++ I would be able to do this:
class Foo {
Foo (string filename); // opens the file (my_file) requested by the filename
~Foo (); // close the file
FILE * my_file; // a persistent file-handle
DataStruct my_data; // ...
In PHP5, what is the difference between using const and static? When is each appropriate? And what role does public, protected and private play - if any.
...
I recently saw some code using macros like
#define CONTAINS(Class, Name)\
private:\
std::list<Class> m_##Name##s;\
public:\
void add_##Name(const Class& a_##Name) {\
m_##Name##s.push_back(a_##Name);\
}\
int get_##Name(int pos) {\
return m_##Name##s.at(pos);\
}\
...
Does the code below smell? I'm refactoring some code and have discovered this circular relationship where foo needs a class which needs an interface which foo itself implements.
In the real code, foo is a Silverlight UserControl and ifoo has methods to do UI type things like raise a dialog box (eg ShowMessage). The needsAnIfoo class is ...
Hi all! I have the following class CppProperty class that holds value:
template<typename TT>
class CppProperty
{
TT val;
public:
CppProperty(void)
{
}
CppProperty(TT aval) : val(aval)
{
}
CppProperty(const CppProperty & rhs)
{
this->val = rhs.val;
}
virtual ~CppProperty(void)
{
...
Hi Friends,
Actually I am interested in improving my designing capability(designing of classes with its properties, methods etc) when a problem is given.
ie How to decide what could be the classes involved? and then decide the methods and properties?
Can you guys suggest me good material for improving on this.
Regards,
Justin Samuel.
...
Hi there, I have a text log from a game with (for example) two types of entries viz. Chat and Event. For the most part they are very similar so I have a LogEntry class defined as so;
class LogEntry < Array
def initialize(str)
super str.split
end
def parse
LogEntry.parse self
end
def LogEntry.parse(entry)
# Proc...
I have this definition in a header file:
class Owner
{
private:
// Fields
Child* _myChild1;
public:
// Constructors
Owner();
Owner(const char childName[]);
};
and this implementation:
Owner::Owner(const char childName[])
{
//do some operations - children must be created after these ops
_myChild = new Child(childName);
}
and th...
Hi,
i want to write an wrapper for different Array Classes with different Policies.
For example:
typedef ArrayType<useValArray,StdAllocator> Array; // one global assignment
I want to use the class like a blitz++ Array
for example:
Array<double,2> x(2,2); //maps the Array to an Valarray or to a Blitz++ Array
Array<double,2> x2(5,...
I am trying to wrap my head around object oriented programming.
My understanding is that we have objects so we can design our programs to mirror real-life objects.
Lets take a class hierarchy:
Fruit (base)
Apple
Fruit has a function void Eat(). Obviously you can use Fruit polymorphically if Eat() is virtual. But does this make sen...
Suppose I have a class like the following:
public class Stage
{
public int ID {get; set;}
public strint Code {get; set;}
public string Name {get; set;}
private List<Machine> _machines;
public List<Machine> Machines
{
get{ return _machines; }
set{ _machines = value; }
}
.........
.........
...
I'm using custom Events in Actionscript 3.0 for the first time and I'm unsure about how to best design them. I need a couple of Events. Some of them need to transport different kinds of data and some don't. Now I don't know whether I should use a single class to implement them all or use separate classes for different kinds of purposes. ...
Hi, I'm writing a HandConverter of a poker hand. This is my first project and I'm trying to do it right from the beginning.
I got already the most parts, like lists of players, their position, stack sizes, cards for different boards, what game is being played and so on, but I struggle with the representation of the betting, especially t...
Scenario: I have the following defined classes.
class Baseclass { };
class DerivedTypeA : public Baseclass { };
class DerivedTypeB : public Baseclass { };
// ... and so on ...
class Container
{
list<Baseclass*> stuff;
list<DerivedTypeA*> specific_stuff;
// ... initializing constructors and so on ...
public:
void add(Basecla...