class

Is putting class name in member routines redundant?

Say you have a class Block... class Block { and it has a function that allows you to show the block on screen. Would you call it... ShowBlock( ... ) or just Show( ... ) This has been irking me, and I'd like to hear others thoughts. On one hand, ShowBlock is completely obvious whenever its used. However, since it will be called f...

Class-behaviour with private fields

I encoutered a somewhat (at least for me) strange behaviour in a library I'm building; I have this method: public class Lib { private string field = "field"; public string Field { get { return field; } } public void Add(Lib lib) { string field = DoSomething(lib); Console.WriteLine(field); } protected string DoSo...

Java Templates array of Template Type in Template

I would like to implement a template which contains an array of the template Type. Is there a way to do something similar to what I have outlined in my sample code? The problem is in the line where this.foo is assigned a new array of the template type. class Classname<T> { T[] foo Classname() { this.foo=new T[128]; } } ...

vptr - virtual tables

hey, there is something i still don't get. for every class i declare there is a hidden vptr member pointing to the class virtual table. let's say i have this declaration : class BASE { virtual_table* vptr; //that's hidden of course , just stating the obvious virtual void foo(); } class DERIVED : public BASE { virtual_tabl...

Instantiating classes by name with factory pattern

Suppose I have a list of classes A, B, C, ... which all inherit from Base. I get the class name as a string from the user, and I want to instantiate the right class and return a pointer to Base. How would you implement this? I thought of using a hash-table with the class name as the key, and a function pointer to a function that instan...

php class for seo

I recently use the great php class call : Google Analytics PHP API. I manage to get it working to get a lot of info and stats for my 25+ website that have analytic Now i like to get more data like The page rank the google placement (where i am on google #325 or #520) Google Page Rank Google Indexed Pages Traffic Rank Inbound Links DMO...

Accessing nib/xib objects from controller.

Hi! I have a UI file in xcode, and I have an AppDelegate class with an awakeFromNib function. From this function, is there a way to change properties of objects which are in the UI? For example, change the string of a label, textfield and so on. Sorry for bad english, tried to explain as well as I could. Any help would be very apprec...

using visio 2007, how do I represent a trigger and a stored procedure?

I have a web service class diagram, I want it to show what stored procedures a web method calls. for now, I just use a class with a metod inside to represent a stored procedure, something like storeStuff(in this, in that, out field1, out field2) but this consumes tons of space, any tips? or are there any better ways to do this? tha...

can two classes see each other using C++?

So I have a class A, where I want to call some class B functions. So I include "b.h". But, in class B, I want to call a class A function. If I include "a.h", it ends up in an infinite loop, right? What can I do about it? ...

Accessing windows application forms from class library in C#

I have a solution in C# with 2 project of 2 different types: windows app and class library. They all share the same namespace but I can't access forms in windows app although I add reference to System.Windows.Form in CL project. Help me, please! ...

Array class not rendering into datagrid

The following application is not rendering the information that I am getting back from a web service into the datagrid. I know I am being able to connect to the webservice because I am getting the count for the class array. I am being able to get a Response.Write but when I try to pull all the information from the array class I haven't ...

C++ error C2819: type 'List' does not have an overloaded member 'operator ->'

I keep getting this error - error C2819: type 'List' does not have an overloaded member 'operator ->' i can't figure out why? help? Main.cpp - #include <iostream> #include <string> #include <cassert> using namespace std; #include "List.h" #include "Node.h" The error happens here: void PrintList ( List list ) { Node * tem...

Scope of class help

Hi I'm trying to reuse some code i was pointed to earlier to run a 3rd party .exe inside of a my winform the code i was given was via Mr. Greg Young public class Native { [DllImport("user32.dll", SetLastError = true)] private static extern uint SetParent(IntPtr hWndChild, IntPtr hWndNewParent); public static v...

How do you set the class of an object to something else?

Hi, I've seen this recently and now I can't find it … How do you set the class of an object to something else? --Update: Well, in Pharo! Like: d:=Object new. d setClass: Dictionary. Only that it isn't actually setClass. How can you modify the class pointer of an object? ...

How to prevent unboxing - boxing memory overhead when reading arbitrary sql rows

Guys, I'm writing a class to represent a row from a SQL query. I want the field data to be accessed via the indexer property of the class. This is straightforward enough if I load the data into an internal List of Object. I've already tried this and am not happy with the boxing for the primitives. Boxing increases the memory requirement...

Java: Static Class?

I have a class full of utility functions. Instantiating an instance of it makes no semantic sense, but I still want to call its methods. What is the best way to deal with this? Static class? Abstract? ...

How do you call the copy constructor within a member function of a class?

Here's what I've got: void set::operator =(const set& source) { if (&source == this) return; clear(); set(source); } And here's the error I get: vset.cxx:33: error: declaration of 'source' shadows a parameter How do I properly do this? ...

nhibernate: how to map two tables to a single non-persistent class?

I have two similar tables: Table1: [ id ] | [ name ] Table2: [ id ] | [ name ] and I need to read/write data using only one class: public class TwinTable { public virtual int Id { get; set; } public virtual string Name1 { get; set; } public virtual string Name2 { get; set; } } Plus one of the tables may or may not have...

Access identically named class members of instances of different classes

I have instances of class A and B, and both classes implement a member 'Text'. Is there a way to access member Text in a generic way? I'm hoping for something analogous to the javascript way of simply saying: instance['Text'] = value; Note: these two classes unfortunately do not both implement the same interface with a Text member. ...

PHP form email script to be used with contact forms?

I am looking for free/opensource php form email script/class. The main requirement is that the PHP (logic) and the HTML and CSS (design) are separated, i.e. i can create forms as short or as long as i need with all kinds of inputs/fields and the script would handle the processing automagically. The form should validate user input (check...