class

PHP include class functions with variables.

I am trying to use a variable to get a function in a extended class, this is what I want to do but I can't get it to work, Thanks for your help. class topclass { function mode() { $mode = 'function()'; $class = new extendclass; $class->$mode; } } ...

Members vs method arguments access in C++

Can I have a method which takes arguments that are denoted with the same names as the members of the holding class? I tried to use this: class Foo { public: int x, y; void set_values(int x, int y) { x = x; y = y; }; }; ... but it doesn't se...

Have you ever used a "class instance variable" in any of your Ruby code?

I can understand why you would need a class variable to keep track of things like the total number of objects that have been instantiated in that class. And I can understand why you would need an instance variable to store attributes of a particular object in that class. But class instance variables I just can't seem to justify. As I ...

C++ Class Declaration

Why does the following program give me an declaration error? Aren't I declaring it at that specific line? #include <iostream> #define MILLION 1000000 using namespace std; class BitInt { public: BigInt(); private: int digit_array[MILLION]; int length; }; BigInt::BigInt() { int length=0; for(int i=0; i<MILLIO...

Type safety: Unchecked cast between Class-Objects

I am quite comfortable with generics and such, but in this special case I have a question concerning the "Type safety: Unchecked cast from .. to .." warning. Basically I have a List of Class objects and now I want to get a subset of these that implement a special interface but the resulting List should also have that special Type: ... ...

How do I get the current file, current class, and current method with Python?

Hello, could i get: Name of the file from where code is running Name of the class from where code is running Name of the method (attribute of the class) where code is running Thanks. ...

Tomcat 6: Importing utility class from WEB-INF/classes

Hi All, (I've removed client name because of NDA) Java/JSP newbie here. I have a JSP site and I have a 'Functions' class in WEB-INF/src/client/project/Functions.java In the Functions.java, the package is com.client.util This is compiled and ends up as WEB-INF/classes/client/project/Functions.class WEB-INF/classes/client/project/Func...

Visual studio refactoring - move class to assembly

Hi, I'm looking for the simplest (and most complete) mechanism to move a class from one to another assembly with reference (dependency) fixing capability.I know some manual ways to do that like : - use built-in move rename, then cutpaste, multiple save ... - use resharper rename namespace, cutpaste , the same as above but with the ...

Best Way of Implementing these 3 classes in C#: Vector, Direction (unit vector), Point

All Points are Vectors, and all Vectors are Points. All Directions are Vectors, NOT all Vectors are Directions (this shouldn't mean both way conversion shouldn't be allowed). I want to have the operators overridden once for all preferably since they're all completely identical. In C++ I can just define class Vector { float x,y,z; }, a...

In Java, why super-class method can't access protected or private methods/variables from sub-class instance?

Let's start from another behavior: even if you declare method/variable as private, another instance of the same class can access it. It's OK I can live with it. I call these class private and not instance private. Now the question part: For example, in runtime I want to be able to check that all String variables in this class are not nu...

PHP multiple MySQL connection though classes/objects?

Here's the code I'm trying to make work: <?php class database { var $connection; function database($host,$username,$password,$database){ $this->connection = mysql_connect($host, $username, $password); mysql_select_db($database,$this->connection); } function query($query){ $query = mysql_query($query,$this...

call function in superclass from subclass

I'm having a small project in Actionscript 3, and everything would be very much easier if it was possible to call code in the superclass from the subclass. This is the project: CarGame         Car is it possible to call a function in the CarGame class from the Car class? ...

C# method that is executed after assembly is loaded

I write some C# class libary and I want to use Ninject to provide dependency injection for my classes. Is it possible for class libary to declare some code (method) that would be executed each fime the class libary is loaded. I need this to define bindings for Ninject. ...

How to tell when a function in another class has been called

I have two Python classes, call them "C1" and "C2". Inside C1 is a function named "F1" and inside C2 is a function named "F2". Is there a way to execute F2 each time F1 is run without making a direct call to F2 from within F1? Is there some other mechanism by which to know when a function from inside another class has been called? I wel...

Using XSLT, how to turn each tag into a div with a class matching the tag name ?

Hi all, Using XSLT, I'd like to be able to transform this : <doc> <tag1>AAA</tag1> Hello ! <tag2>BBB</tag2> </doc> into this : <div class="doc"> <div class="tag1">AAA</div> Hello ! <div class="tag2">BBB</div> </div> ...but without specifying explicitly any tag name in the stylesheet (there are too many in the real worl...

.NET Project Reference: How to reference a dll via a referenced project?

Hope I'm asking this correctly: I have a project Projects.Client I have my class library ( infrastructure stuff I use all the time ) Library Assuming these are both projects, how can I do this from a class in the "Projects.Client" using Library; public class xxx { public void DoSomething() { Library.SomeDll.DoS...

JAR file not opening on a Mac

Hi guys, I have been trying to open a JAR file on my Mac with no success. It says the JAR file could not be opened and asks me to look for any error messages in my console. Here are the console messages, I suspect the prob is in the first line itself, but I am not from software background, so don't know if this is enough for anyone who ...

Generating Class Diagram

HI All I am at the end of the release of my project.So in order to keep working our manger asked us to generate Class Diagrams for the code we had written.Its medium project with 3500 java files .So I think we need to generate class diagrams.First I need to know how reverse engineering works here. Also I looked for some tools in Google(G...

How do I make a constuctor available to only the factory class?

Ok, the question might not be crystal clear. Let me give some details: Let's say I have an Shoe (CShoe) object factory class called CFactory. CFactory is a singleton class that creates and stores all instanciated shoes using a simple hashmap. It is then accessed through static methods to use the created objects. Is there a way to force...

Difference between Decimal and decimal

If someone could explain to me the difference between Decimal and decimal in C# that would be great. In a more general fashion, what is the difference between the lower-case structs like decimal, int, string and the upper case classes Decimal, Int32, String. Is the only difference that the upper case classes also wrap functions (like D...