class

[C++] Map functions of a class

Hi! Before I was trying to map my classes and namespaces, by using static calls I succeded and now I need to map the functions of my classes because they will be used dinamically. Firstly I was thinking to hardcode in the constructor so I can assign a std:map with the string of the name of function pointing to the function itself. f...

calling a class with ajax

I need some help with this please I can't get a handle on it. The problem is that I want to call a class method, in this case with static methods with an ajax call. I have put the helper class in the same folder as the script that is called by ajax for easy referencing and try to include it. Could it be that my refencing is wrong? If...

Sharing methods between two implementations of a virtual base class in C++

I have a virtual base class and two classes that implement the various methods. The two classes have the same functionality for one of the methods. Is there away I can share the implementation between the two classes to eliminate redundant code? I tried making the first class a parent of the second class in addition to the virtual base c...

How to find all classes of a particular interface within an assembly in .net

I have a scenario whereby I want n amount of classes to look at the same data and decide if any work needs to be done. Work is done by a team, and multiple teams can work on the data at the same time. I was thinking of creating a class for every team that would implement the CreateWork interface. All CreateWork classes must have their sa...

C++ inheritance problem

Here are my classes: ParentClass, ParentObj DerivedClass (inherits from ParentClass), DerivedObj (inherits from ParentObj). ParentClass has a protected member: std::vector< ParentObj* > DerivedClass allocates only DerivedObj* objects to this vector. Problem is: When I use ParentClass, I want to access its vector object...

Whats the best way to name id & classes in CSS and HTML

When naming classes and ids for CSS what is the best method to use. In this case I need there to be some kind of naming convention so that other people can pick up rules and understand how to name their own ids and classes using the same pattern. Any suggestions? Some of the sites we create can get pretty complex but use an overall struc...

Compact Class DSL in python

I want to have compact class based python DSLs in the following form: class MyClass(Static): z = 3 def _init_(cls, x=0): cls._x = x def set_x(cls, x): cls._x = x def print_x_plus_z(cls): print cls._x + cls.z @property def x(cls): return cls._x class MyOtherClass(MyClass): z...

C#: Custom 2-dim arrays trouble

I'm trying to create a two-dimensional array of my custom class Cell with the following code: public class Cell { int top; int bottom; } public Form1() { Cell[,] elements; elements = new Cell[10,10]; Random r = new Random(); for (int i=0; i!=10; i++) { for (int j=0; j!=10; j++) { ...

Css Selector problem

How do I do a css selector that selects a div that has the class of "someButton" AND "current"? .someButton .current { /* select current with the parent div of .someButton, correct? */ Please help me figure this out! ...

[C++] Map functions of a class while declaring the functions

Hi, My previous question about this subject was answered and I got some tests working nice. http://stackoverflow.com/questions/1786809/c-map-functions-of-a-class My question is now, if there is a way to while declaring the function, be able to register it in a map, like I realized in this question about namespaces and classes: http://s...

how to copy a list to a new list, or retrieve list by value in c#

I noticed in c# there is a method for Lists: CopyTo -> that copies to arrays, is there a nicer way to copy to a new list? problem is, I want to retrieve the list by value to be able to remove items before displaying them, i dont want the original list to be modified, that too doesnt seem to be easily attainable, any ideas? ...

Can a C++ Class Constructor Know Its Instance Name?

Is it possible to know the object instance name / variable name from within a class method? For example: #include <iostream> using namespace std; class Foo { public: void Print(); }; void Foo::Print() { // what should be ????????? below ? // cout << "Instance name = " << ?????????; } int main() { Foo a, ...

draw dependency graph for a java class

Heyho, I'm searching for a tool like JDepend to draw a graph for a java classfile. JDepend seams to be fine, but it's not resolving the deps from the deps (maybe I'm just missing some special options?). A direct output into .dot format or an image would be nice to have. Thanks ...

c++ vector of class object pointers

Hi all, What I am trying to do is essentially create two vectors of objects, where some objects are entered into both lists and some are just entered into one. The first problem I found was that when I used push_back() to add an object into both lists the object was copied so that when I changed it from one list the object did not chang...

Outer Java class is able to access inner class private members?

I observed that Outer classes can access inner classes private instance variables. How is this possible? A sample code demonstrating the same is explained below:: class ABC{ class XYZ{ private int x=10; } public static void main(String... args){ ABC.XYZ xx = new ABC().new XYZ(); System.out.println("H...

Namespace Class clash in csharp - looking for suggestions

Hi, im building a generic articles framework and my namespace names are clashing with my entities: Namespace: MyCompany.Articles.Modules Class: Articles, Article Any suggestions to how this can be avoided? According to MS I should use the following format: <Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>]. Thanks. ...

How to tell difference between python class and object?

Possible Duplicate: How to identiy whether a variable is a class or an object I have a function which accepts 'things' which it calls. def run_it(thingy): result = thingy(something) However, I'd like run_it() to accept both classes and objects/functions, and if it is a class, instantiate it first: def run_it(thingy): ...

What is the difference between -> and :: in PHP?

Hi, This thing has been bugging me for long and I can't find it anywhere! What is the difference when using classes in php between :: and -> Let me give an example. Imagine a class named MyClass and in this class there is a function myFunction What is the difference between using: MyClass myclass = new MyClass myclass::myFunction()...

constructor as default argument

let's say i have 2 classes class B { B() { /* BLA BLA */ }; B(int a) { /* BLA BLA */ }; B(int a,int b) { /* BLA BLA */ }; } class A { public : A(B par); } i was wondering how can i call A's constructor with par having a deafult argument, as each of B constructors. (of course i would like see 3 examples, i don't expect all...

Difference between implementing a class inside a .h file or in a .cpp file

Hello, I was wondering which are the differences between declaring and implementing a class solely in a header file, compared with normal approach in which you protype class in the header and implement in effective .cpp file. To explain better what I'm talking about I mean differences between normal approach: // File class.h class MyCl...