class

When to use __gc for classes and structs?

I am updating some old c++ code and am finding that many of the classes are defined as: public __gc class NameOfClass{ } I found a little bit of information about __gc here, but it seems to only come up with information for VS 2003. The MSDN documentation that came with my copy of VS 2005 indicates that __gc may not be in use anymor...

Newbie Confusion regarding classes

I have been trying, without success, to control an object within a class from without such class. These are the important bits (not the whole thing!) def GOGO(): ################################################ VFrame.SetStatusText("Ok") # ----> THIS IS WHAT I AM TRYING TO FIX # ...

php check if abstract method exists

abstract class A{ abstract test(); function __construct (){ //check if test method exists on B// } } class B extends A{ } new B(); my question is ... is there a way to check if the test method exists on class B? so I can avoid the fatal error ? hope it makes sense. ...

why a class cannot be defined as protected?

I know this is a stupid question, but still i have a doubt which needs to be cleared. My question is why cannot we define a class as protected. I know we cannot but why? There should be some specific reason. ...

use a class in another DLL in C#

I have a project in which i created a class called "validator". i also created a DLL that has a function that i want to pass the validator class as a parameter. but the DLL doesn't know the class in my project cause it is a different DLL. i also can't add a reference in the dll to the project because the project has already a reference...

how to avoid Cannot redeclare class for 2 diffrent classes with same name

I'm trying to include some functions from phpBB board to my application like a single login. But if i include the common.php it says "Cannot redeclare class user", because my application already has a class user. Is there a way to avoid this ? I tried a little with namespaces, but I never worked with them. So I need a way to include 2 c...

References classes?

what's the correct way to reference a class, in this case from the same package. the code below shows class "Two" attempting to trace the value of a variable in class "One". no success. trace returns undefined. //Class One package { import flash.display.Sprite; public class One extends Sprite { public var myString:String =...

PHP Indirect modification of overloaded property

Hi, i have this simple class: class A { var $children=array(); function &__get($name) { if($name==="firstChild") { if(count($this->children)) $ret=&$this->children[0]; else $ret=null; } return $ret; } } By accessing the "firstChild" property it should return its ...

Pros and Cons of Class Creation Script in Javascript?

Hi, I recently wrote a class creation script (with the help of Crockford's and Resig's code for certain parts) that automates certain tasks such as: merging defaults with passed in params, requiring params, creating a bridge between DOM and class instance, binding custom events with a common namespace, inheritance with access to super m...

Self-referencing classes in python?

In Python, can you have classes with members that are themselves pointers to members of the type of the same class? For example, in C, you might have the following class for a node in a binary tree: struct node { int data; struct node* left; struct node* right; } How would you equivalently create this in python? ...

Organizing Long Scripts In Separate Files?

In an attempt to organize my code, I'm trying to split up my (lengthy) main controller class into separate files, but my new files must still have access to the variables and functions of the main controller class. I'm trying to cut and paste code from my controller class into a new class/file, allowing the controller class to call the ...

How can I reorganize my code into classes in C#?

I'm working on a project in C# w/ XNA, and I want to reorganize it and divide parts of it into classes. At present, it's just one game.cs file, but I want to clean it up a bit. Unfortunately, I'm not too familiar with classes. Perhaps someone can help me figure out how to do this, or direct me to some tutorial of some sort? ...

Edit-and-continue only works on some classes in my VS 2008 project

I have a very strange problem. In my quite large project I have an extensive backend library of classes all belonging to the same Assembly. When I run the code Edit and Continue works fine in all forms and files belonging to the UI, but when I attempt to edit a class I get the "Cannot currently modify this text in the editor. It is read-...

No Default.aspx.designer.cs files in my ASP.NET project

My current Web Site does not have any designer.cs files. (Yes it is not a Web Application) The site is complete but now I added 2 Clases to my site and all good but when I want to make use of my GridView it tells me this: This is because I wrapped my code with the same namespace as in my classes like so.... namespace samrasWebPort...

Most useful .NET utility classes

Hi, This post is for all .NET developers who often tries to reinvent the utility classes which already does by many programmers around the world. I request everyone to please post your favourite utility classes(with code) here. To start the show, Given below is the c# code for multithreaded singleton. Multithreaded Singleton using...

Problem with a class BlogRssParser.m (iphone)

I want to change the feed source... the code is: // // BlogRssParser.h // RssFun // // Created by Imthiaz Rafiq on 8/15/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import <Foundation/Foundation.h> @class BlogRss; @protocol BlogRssParserDelegate; @interface BlogRssParser : NSObject { BlogRss * _currentI...

Simple class using php

hello I'm new to PHP and I need help to understand the basics of PHP class. I want to have example of a class that uses private public protected and static. and how do they work.. Thanks in advance. Oh I forgot how to extends also. I'm talking about the parent and child something or what.. Thanks again. ...

Access static variables in ObjC categories

I'm trying to implement a category of an existing class. There is a static variable in the existing class. If I try to access the static variable from a category, I'm getting an error that the static variable is undeclared. Is it possible to access static variables in ObjC Categories ? ...

Why protected and private attributes are accessible by same class rather than by the same object ?

For example, we have the class Man If Man.age is protected, then I don't see why chuckNorris (instance of class Man) can change the protected/private attribute age of the object jackBauer (another instance of class Man). He shouldn't be able to do that (IMO). In my mind, the value of a protected/private attribute is supposed to belong ...

Looping through several functions in PHP

Hello, Basically I want to achieve such functionality that 5-10 functions are executed in a row (like normally). However, I want the script to go back several steps back (ex. from 5th back to 3rd) and continue further (like 4,5,6,7,8,9,10), if specific return is received. Example: <? function_1st(); function_2nd(); function_3rd(); funct...