The lightbulb has yet to go on for this...
I'd really love an easy to understand explanation of the advantage to using a class in php over just using functions.
Here's a simple example of the thought I'm having now and am wondering if a class is more efficient:
Say I have a mini calendar widget that I've built in php. I'm thinking ...
hi
Is it possible to use boost type traits or some other mechanism to check if a particular template parameter has an operator/function, e.g. std::vector as a template parameter has operator[], while std::pair does not.
...
I have a static function in a class that needs to be called from several child classes. I need a constant from the calling child class to be available in that function. To have these constants available in other places, the child classes have a function that returns the value of that constant (php 5.2.9).
However, when in the parent cla...
Below are the files in PHP that I am trying to include a file that holds an array into my class and then access the array. if I run print_r() on it I get results but if I try to access the array item individually I get nothing, can anyone help me please?
<?php
// config.class.php
/*
example usages
$config = Config::getInstance(PATH_TO_...
Having hard time understanding classes and why I can't access certain object.
How can i modify the code so I can change "map"(which is a bunch of labels) properties in all of my classes/events?
The method Draw2d() creates a couple of labels on the main form that I wish to change on different events(button click in this example).
Can so...
I have a number of GUI dialogs defined using MXML. Assuming these mxml objects have been compiled into my application, is there any way to instantiate these objects using ActionScript, sort of like this?
myFoo: Mxml2ActionScriptClass("FOO.mxml") = new AutomagicalMXMLFactory( "FOO.mxml");
myFoo.addEventListener(etc etc)
th...
Hello,
I am new to c++ and i have a question.
Lets say we have a base class Base and two derived classes, Derived1 and Derived2.
f.e. Derived1 has a constructor taking a integer and Derived2 a constructor taking a boolean.
Is it possible to determine at run time (or at compile time) which of those two subclasses to create and assign i...
Right now since I am new to using Objects in PHP I feel like in my head, I think of a PHP object as being something big and bulky. This makes me want to use them less often, I feel Like I am taking really simple code and really over-complicating it by putting it into objects.
If I have a database, cache, session, core, and user objec...
Hi. how can i set a field in a class that it's name is dynamic and stored in a string variable ?
public class test {
public String a1;
public string a2;
public test(String key) {
this.key='found'; <--- error
}
}
...
hi,
i need to write function that searches & replaces key in multi-dimensional array in following manner:
input array:
[0] => Array
(
[Foo] => sometext
[Foo2] => Array
(
[lorem] => 1
[Avatar2] => Array
(
[meta_key] => avatar2
[...
Hi,
is there a way to add class to only one level on li tags? in m case at the moment it looks like this:
<ul>
<li></li>
<li>
<ul>
<li></li>
<li></li>
</ul>
</li>
<li></li>
</ul>
And this is what I need
<ul>
<li class="lev-one"></li>
<li class="lev-one">
<ul>
...
Hello,
Well, I keep improving my form generation classes and stuck in returning all the country elements in country_data array. Only first two elements is displaying on dropdown options.
Here is dropdown class:
//drop down form class
class DropDown
{
function __construct ($form, $field_label, $field_name, $field_desc, $dropdown_da...
Hi Everyone,
I am wondering how to simulate Class Inheritance in JavaScript. I know class doesn't apply to JavaScript, the way we use is Functions to create objects and do the inheritance things through Prototype object.
For example, how do you convert this structure into JavaScript :
public class Mankind {
public string name;
...
When designing my software, I began with interfaces since this seems to be the "standard". Then I switched to abstract classes because they seem better suited to the problem at hand. However I'm not sure if I've missed out on some considerations when making this design choice. Other than domain specific issues which I have thought abo...
Hi,
I have two classes declared as below:
class User
{
public:
MyMessageBox dataMsgBox;
};
class MyMessageBox
{
public:
void sendMessage(Message *msg, User *recvr);
Message receiveMessage();
vector<Message> *dataMessageList;
};
When I try to compile it using gcc, it gives the following error:
'MyMessageBox does not name a type'....
I have just installed JDK on Windows Vista. After that I set proper values for the 4 environment variables: classpath, include, lib, path. After that I was able to compile my HelloWorld-program (I got a *.class file). But when I try to execute the compiled program (I type java HelloWorldApp) it does not work. The Java write a lot of stuf...
I was wondering how to return the position of a list element with a class of 'currentTab' in the following unordered list:
<ul id="coverTabs">
<li class="currentTab"><a href="#">Individual</a></li>
<li><a href="#">Couple</a></li>
<li><a href="#">Family</a></li>
<li><a href="#">Single parent family</a></li>
</ul>
The ...
Trying to improve my code's agility and loading time, I thought of doing this,
so that the functions would be required only if the class was instantiated.
class User
{
public function __construct()
{
require('all_user_fns.php');
}
}
Inside all_user_fns.php will reside all User class's functions.
Is that feasible (...
My latest idea for do settings across my php project I am building was to store all my settings in a config PHP file, the php file will just return an array like this...
<?php
/**
* @Filename app-config.php
* @description Array to return to our config class
*/
return array(
'db_host' => 'localhost',
'db_name' => 'socialnetwor...
What Considerations do we need when creating a DB helper class in .Net?
...