I've got the following code:
class the_class {
private the_field;
function the_class() {
the_field = new other_class(); //has other_method()
}
function method() {
$this->the_field->other_method(); //This doesn't seem to work
}
}
Is there anything wrong with the syntax here? The method call always seems to return tr...
After a little research I've determined that the only access modifiers which you can apply to classes are:
public - available in any assembly
internal - available only in the current assembly
but the error message below seems to imply that if a class is not defined in a namespace that it could be defined as private, protected, or pro...
I'm working a java+swing+miglayout project we settled on a class design for graphical classes that inherits from JPanel & JFrame, here is the skelletons :
class GammaFrame extends JFrame {
private JPanel __pane__ = null;
public static GammaFrame open(...) {
_instance = GammaFrame()
__pane__ = _instance.getContentPane();
_...
Javascript is a powerful language but I can't get it why there are several ways to OOP, don't you think that it is adding a frontline barrier for new developers which have to work harder to master the libraries?
...
Hi everyone -
I'm coding a poker hand evaluator as my first programming project. I've made it through three classes, each of which accomplishes its narrowly-defined task very well:
HandRange = a string-like object (e.g. "AA"). getHands() returns a list of tuples for each specific hand within the string:
[(Ad,Ac),(Ad,Ah),(Ad,As),(Ac,Ah...
Earlier, I asked a question on how to call a static member's member functions so as to initialize it before making actual use of the static object. Then, I realized that I was perhaps making use of the static member in a wrong way, which led to this question:
Given a particular class, MyClass, in how many ways can we design our code so ...
Hi. I have a tree-like object structure that consists of two types of objects:
object of class Category
object of class CategoryLink
The structure is the following:
The whole story begins with an array of Categories that have no parent
Each Category has a few unimportant properties and a few important:
$parent - containing an id of ...
Hi,
This is probably asked before but I have no idea what to search for. This is my hierarchy now: NSObject > FirstSubclass > SecondSubclass. But I'm going to implement a new feature in my app which requires changing a few details in FirstSubclass when a certain condition is met. So actually I would need a subclass between FirstSubclass...
I'm new to design patterns, and thus have a limited knowledge of what all is available. Hopefully I can give some details around the issue I'm trying to solve, and the user community can give some guidance on what design pattern to use and how it should be implemented.
Return object is the same for every type of call
Underlying clas...
Hi everyone,
I recently had my code reviewed by a senior developer in my company. He criticized my design for using too many classes. I am interested to hear your reactions.
I was tasked to create a service which produces an xml file as a result of manipulating 3 other xml files. Let's name these aaa.xml, bbb.xml and ccc.xml. The ser...
I have one page with two types of forms. I have a single form of type A at the top, and then I have 1 or more forms of type B below it.
I use the Module pattern + jQuery to wire up all the events on my forms, handle validation, ajax calls, etc.
Is this the preferred/valid way to define a singleton, as in Form A, and a reusable object ...
This is what I have: All objects that can be persisted on the database extend the DatabaseObject abstract class, which has all the logic code to actually watch for attribute changes and run the databas queries.
I'm using two static variables to define object-specific details. I define them generically in the base class, and then suppose...
i want to make an object which can do all the actions my form needs -- it can validate the form, submit the form, and so forth. i want javascript to do all these things. i no longer want to write same code several times over in procedural fashion javascript in global namespace. i want to create Javascript object to handle these functions...
hi,
im looking to create a web app using php, mysql. im planning to write it in classes.
i have created 3 classes: CBaseUser, CWaiter, CBaseAuth
so basically CBaseUser will be a parent class to CWaiter and CBaseAuth contains things like GetPasswdLen(), CreatePasswd(), GetToken().
so right now im heading to do the rest of the program ...
I have module called Mobile::Auth to authorize and redirect to the login page. I wanted to access all methods from Site::Auth in my Mobile::Auth except a method '*redirect_to_login_page*', which I have specific one for my Mobile::Auth. I did something like this..
package Mobile:Auth;
use base Site::Auth;
sub redirect_to_login_page{
#g...
Possible Duplicate:
What areas of code are you using f# for?
F# is a language that will be used more and more.
Microsoft has built in Visual Studio 2010 F# and the potential is huge, like I've read in several IT magazines.
So let's collect useful information about the "right" application of F# and what advantages we could ge...
Please see the code below :
package bk;
public class A {
protected void methodA() {
System.out.println("Calling the method A !");
}
}
// And I have an another package :
package com;
import bk.A;
public class B extends A {
public void methodB() {
System.out.println("Goi phuong thuc B !");
}
pu...
Hi,
I have the following code:
$sql_latest = "SELECT * FROM tbl_latest ORDER BY id DESC LIMIT 0,3 ";
$results_latest = $mysqli->query($sql_latest);
while($row = $results_latest->fetch_object())
{
echo $row->id;
}
How can I get the results into a array so I can do something like
echo $row[1];
echo $row[2];
echo $row[2];
...
Hey.
Please consider the code below.
class A {
public function __construct() {
}
}
class B extends A {
public $a = "a";
public $b = "b";
public $c = "c";
}
How do I get the class B's public variables from within the parent class without knowing precisely what they are?
...
This is a follow up from yesterday's scope question.
stackoverflow.com/questions/3301377/class-scope-question-in-php
Today I want to share the "$template_instance" variable with a child class.
How is this accomplished?
require_once("/classes/Conf.php");
require_once("/classes/Application.php");
class index extends Application
{
p...