class

Should you format operator<< for classes?

As in, should the operator>> match the operator<< ? Database Example: If the operator>> reads in something of the following format: 2 Joe 500 20 1 Bob 250 30 0 should the operator<< output that? Or something like this: Record: 1/2 Name: Joe Balance: 500 Transactions: 20 Premium Account: Yes And then have a separate writeFile() fu...

Wicket - runtime class reloading

Hi, I have classical complaint - rebuilding and reloading the web app takes too long. I want to compile the classes (preferrably from the IDE) or change a static file and let the server check what changed and act approprietly (reload the class/file). What are my options for Wicket + JDK 1.6 ? I'd prefer Jetty, but Tomcat, JBoss AS or o...

Preventing compilers from defining copy constructors and operator = overload for C++ Classes

Is there a way by which we can prevent compilers from defining copy constructors, operator = overload for C++ classes. ...

how to define a class in only one line?

I tried class X begin end and class X {} neight correct. What is the right code? ...

php classe: problem getting value from function into a member variable

I have a function that gets a value from the database and returns it. I call the function to store it into a member variable but I get the following error: Parse error: parse error, expecting `','' or `';'' in I:\wamp\www\deposit\classes\Site.php on line 14 This is the line that causes the error public static $depositmoney = self::ge...

C# generics - Can I make T be from one of two choices?

Suppose I have the following class hierarchy: Class A {...} Class B : A {...} Class C : A {...} What I currently have is Class D<T> where T : A {...} but I'd like something of the form Class D<T> where T in {B,C} This is due to some odd behavior I'm not responsible for where B and C have common methods which aren't in A, but ...

Fatal error: Using $this when not in object context

I'm creating my class like I always do. I create the member variables, I setup the setter and getter and the I use $this to call the values of the member variables. but for some reason now I'm get the fatal error: Using $this when not in object context Here is the regular php file which should populates the member variables with their v...

mysql_fetch_array(): supplied argument is not a valid MySQL

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/davzyco1/public_html/notes/functions.php on line 43 is the error I get when I use the below class, even though the class works PERFECTLY with my old webhost. Here's my new hosts php info: http://davzy.com/notes/php.php class mysqlDb { pub...

What is the use of ContextBinding in vb.net?

I am trying to bind nested object to a datagridview in vb.net. and somewhere i found referring me contextbinding. I searched but didn't find any good example and desription of it. can anybody help me with this one for binding nested class object to a datagrid Edited: to add link http://msdn.microsoft.com/en-us/library/system.windows.f...

Prototype select class contained in a div

Hi, I would like to use the following function only on the "a" elements contained in the div "myDiv". This is the code I have been using so far: $$('a[class="active"]').each(function(element) { element.removeClassName("active"); }); ...

Returning class type in ruby

I need a function that checks the namespace of the argument, and returns the class type for example: checkType(id) if id starts with "p:" return <Class Type> end I do not have an instance to use when checking the type of the id ...

How to copy all properties of a class to a new subclass in Perl ?

my $t=TT::Pop->new(name => "shadowfax", color => "white"); my $w=TT::Pop::Subs->new($t); How to write TT::Pop::Subs::new() so that I can make $w cantains all the properties from $t ? In other words, I want to initialize a class with its super class. In this case, all properties from $t should be readonly, so copy by ref is acceptable....

Doesn't C++ IDE Netbeans or Eclipse support class inheritance?

Hi, I am using NetBeans IDE 6.8 to create C++ project. While I use class inheritance, however, it seems to me that it does not recognize the derived class. Here is what I have: class A { public: A(vector<double> a, double b) {...} }; class B : public A { public: additionalfunction(...) {...} }; main() { vector<double> c = ...

How to use Enum with strings in a function?

Basically, I have a Linked List which implements a display()function that simply loops throught he elements and prints out their values. I wanted to do it like this: void List::display( std::string type ) { switch(type) { // Do stuff... The compiler immediately complained. My teacher said this would be because the strin...

Arrays of data classes in C#

OK, I've been messing around with this for ages and I'm not getting any closer. My current version is as below. The comments are what I think I'm doing. The semantic is basically an index number (like a house number) and a list of attributes in an array. Then create an array 'street'. I want to be able to update the values of all element...

Options for granting access to class data members (C++)

This is a basic question about what options are available for defining the scope of some parameters. I'd particularly like to have a sense of the tradeoffs in speed, memory, code clarity, ease of implementation, and code safety. My programming experience is clearly modest, and I have little formal training. I suspect one or two options w...

Usage of this pointer

I have a question relating to the usage of "this". Suppose I have two classes A & B; their rough outline is as follows: class A { public: ... void AddB( B* b ) { // inserts B into the vector v } private: std::vector<B*> v; }; class B { public: ... void foo( void ) { ... // Adds itself to th...

Swap CSS style of a group of elements on click

I found a thread, http://stackoverflow.com/questions/195951/change-an-elements-css-class-with-javascript, that is along the lines of what I'm going for, but I don't know how to implement it. I have a page with 4 input buttons and two CSS styles: "Selected" and "notSelected". One button will be hard coded initially as "Selected". When ...

Dependency Walker for Java?

I am looking for a tool that lists the .class dependencies for a given Java class to run. Kind of like what Dependency Walker does for Windows applications. I am aware of some tools, but they are overly complicated or not quite a match, including Class Dependency Analyzer GenJar Dependency Finder One-JAR Any suggestions? TIA!! ...

calling class method (with constructors) without object instantiation in php

Hi everyone, Ive looked and tried but I can't find an answer. In PHP, is it possible to call a class' member function (when that class requires a constructor to receive parameters) without instantiating it as an object? A code example (which gives errors): <?php class Test { private $end=""; function __construct($value) {...