class

iPhone Obj-C: Anonymous Category or "private" Category?

Style-wise (and functionally, if there is any difference), for declaring private methods, which of these is better? @interface MyClass() @interface MyClass(private) ...

Taking type of a template class

Hi everyone i have a question about templates, is there a way for taking type of a template class, for example //i have template function template<typename T> IData* createData(); //a template class instance std::vector<int> a; //using type of this instance in another template //part in quotation mark is imaginary of course :D IData...

PHP Object Extension Question

So I have an item class as follows: class Item { private $db; private $data = array( 'AltItem1' => null, 'AltItem2' => null, 'BaseUOM' => null, 'Category1' => null, 'Category2' => null, 'Category3' => null, 'Category4' => null, 'Iden' => null, 'IsHCS' => null, 'ItemDesc' => nul...

Mentioning the HTML TAG element before a CLASS or ID (Good or unnecesary CSS practice?)

Basically, I want to know what is best to avoid future problems and confusions with CSS code... Naming CSS proprieties like this: div#content ul#navigation div.float-left (Its really unnecessary to do this?) or just #content #navigation .float-left I don't have experience with big projects so I wish someone could tell me which ...

What are the benefits to using a partial class as opposed to an abstract one?

I have been reading Programming Microsoft® Visual C#® 2008: The Language to get a better understanding of C# and what can be done with it. I came across partial classes which I had already encountered from ASP.Net's Page class. To me it seems that you can do what partial classes do with an abstract class and an overridden one. Obviously...

Settings class architecture.

Just wondering what the best practise advice would be on the architecture for a settings class. We've a number of tables which will be used to populate the class, I'm guessing a Hashtable is the best way to go? It also would be nice to have a strongly typed collection available through the scope of the app in Intellisense. e.g. Settin...

Call different classes in different time in same function

I just cannot imaginate a way to do a call to a function with genericity. I have a code which a have to call a function in two different classes in different moments. I have A and B classes which I can access one time or other time. Or I access A or I access B. Not both in the same type. I have code this program but I just cannot imag...

C++ - Calling a function inside a class with the same name as the class

I was trying to write up a class in c++, and I came across a rather odd problem: calling outside functions inside of a class that have the same name as the class. It's kinda confusing, so here's an example: void A(char* D) { printf(D); } class A { public: A(int B); void C(); }; A::A(int B) { // something here } void A::C() {...

Objective C class initialization errors

I have the following objective C class. It is to store information on a film for a cinema style setting, Title venue ID etc. Whenever I try to create an object of this class: Film film = [[Film alloc] init]; i get the following errors: variable-sizedobject may not be initialized, statically allocated instance of Objective-C class "Fil...

What classes/interfaces should every .NET developer know?

I just saw an interview with Luca Bolognese from the MS language team, and he mentioned that Anders Hejlsberg thinks developers should focus more on the BCL (base class library, framework) instead of lanugage features (C#, VB.NET). Which class or interface in the current .net 3.5 framework should every developer know? ...

Can PHP store Object state like the following code?

Hi, I am a newbie in PHP and I am asking wether I can initialize once for all data inside an object and use them later <? class Person(){ private $data;//private or public function Person($data){ $this->data['name'] = $data['name']; .... } function save(){ $this->dbconn.executeQuery('insert into ... va...

When wouldn't NSObject be stated as the parent class?

For example: @interface Fraction: NSObject { ... When wouldn't NSObject be used and is NSObject the ultimate parent class for all other classes? Please feel free to correct me on any wrong terminology used. ...

Ruby: a class extending a module

Hi, I'm trying to to define a class called "HTML" to extend Nokogiri - which uses modules. I tried the following: require 'nokogiri' class HTML include Nokogiri end and require 'nokogiri' class HTML extend Nokogiri end but so far it's been impossible that the class HTML inherit of all the functions in nokogiri. So stuf...

I need a Python class that keep tracks of how many times it is instantiated

I need a class that works like this: >>> a=Foo() >>> b=Foo() >>> c=Foo() >>> c.i 3 Here is my try: class Foo(object): i = 0 def __init__(self): Foo.i += 1 It works as required, but I wonder if there is a more pythonic way to do it. ...

How can I determine whether a Java class is abstract by reflection

I am interating through classes in a Jar file and wish to find those which are not abstract. I can solve this by instantiating the classes and trapping InstantiationException but that has a performance hit as some classes have heavy startup. I can't find anything obviously like isAbstract() in the Class.java docs. (many thanks for the ra...

Rails /lib modules and

I am writing a custom wrapper for open_flash_chart plugin. It's placed in /lib and load it as a module in ApplicationController. However, I have some Class hierarchy or smth problem. From any controller I can access open_flash_chart functions as OpenFlashChart, Line etc However, in a class in a /lib module, it doesnt work! Any ideas?...

Does jQuery or JavaScript have the concept of classes and objects?

I found the following code somewhere, but I am not understanding the code properly. ArticleVote.submitVote('no');return false; Is ArticleVote a class and submitVote() a function of that class? Or what does the above code mean? And is there any concept of classes and objects in jQuery or in traditional JavaScript? How to create them?...

css with links

I am assisting with the creation of a new website and tend to run into simple errors as I go. The following code is being used to style a link: a.homepage-employment, a:visited.homepage-employment { display:block; padding:5px; background-color:#055830; color:#fff; width:100%; } a:hover.homepage-employment { display:block; padding:5px; ...

Using current class in Java static method declaration

My Java is rusty so please bear with me. In C I can do: int someFunc(void) { printf("I'm in %s\n", __func__); } In Java, can I lexically get to the name or class of the type currently being defined. For example, if I have: import org.apache.log4j.Logger; class myClass { private static final Logger logger = Logger.getLogger(m...

How do you Specify a Method to be a Destructor Rather than a Constructor in C++?

How do you specify a method to be a destructor rather than a constructor in C++? This confuses me very much. I can't tell the difference between the two. ...