class

PHP Inheritance: If A then Must Set B

So, I tried to Google this but don't know what this kind of situation is called... I'm working on my first use of class inheritance, where a parent class defines a set of methods and then several other classes extend that parent. What I was wondering, is it possible to do something like this: class foo { private bar = false; priva...

How do I do this in ASP.net?

I want to implement a shopping basket. I created a shopping basket class, and included all the functions inside it that basket will need. It works OK, but on every content page I need the lines: Basket myBasket = new Basket(); myBasket.drawBasket(); Is there anyway to get that code to execute on every page without having to manually...

How can I use 3-dimensional data as a class property?

It's been a long time since I worked with C++, but I have a class that uses 3-dimensional data and I can't figure out how I can make this work. I need the sizes of the dimensions to be defined in the constructor. I tried this in the header: class CImage { public: float values[][][]; ... } and this in the constructor: CImage::CIma...

Accessing contained class' properties in Gridviews boundfield.

I wonder why asp.net wont allow accessing property of contained class on Gridview's Boundfields while it work in ItemTemplates.. Class User { Diagnosis diagnosis { get; set; } // Contained class } Class Diagnosis { string DiagnosisCode { get; set; } } gridview.datasource = new List<User>() { new User() { diagnosis = n...

Easy way of overriding default methods in custom Python classes?

I have a class called Cell: class Cell: def __init__(self, value, color, size): self._value = value self._color = color self._size = size # and other methods... Cell._value will store a string, integer, etc. (whatever I am using that object for). I want all default methods that would normally use the ...

is there a way to modify property of css div in html

I am kind of new to css and html coming form Actionscirpt.. I was wonder if there is a better way to do this. I created an external css with following div. #myDiv{ position:absolute; top:200px; left:200px; width:200px; height:200px; } and in html I want to use the same div for 3 different things with different value/property. <di...

How do I change the values of arrays from different classes?

How do I change the values of arrays from different classes? i've array in one class called creation all the array are global variable import addClass; public var first1:Array = new Array(); public var op:Array = new Array(); public var second:Array = new Array(); public var res:Array = ...

If i extend a static class in PHP, and the parent class refers to "self::", will this refer to the self in the extended class?

If i extend a static class in PHP, and the parent class refers to "self::", will this refer to the self in the extended class? So, for example <?php Class A { static $var public static function guess(){self::$var = rand(); return $var} } Class B extends Class A { public static function getVar(){return self::$var...

Dynamically list all members of a class

Hi, Is it possible in C++ to dynamically (during run-time) get a list of all members of the class? Greetings ...

Android: add new view with a XML Layout file

I am beginning developing android application. What I need to know is how to associated a xml layout file with a new class (not the activity). For example the class needs to have a table with an image and some texts. thanks! ...

how do i solve this bad error

as you see this is a class create 4 text Fields , what i woona do is in this line of code first1[i].text = k1[i]; in the for loop to write the randomize numbers in the TextFields that's my code import flash.display.Sprite; import flash.display.DisplayObjectContainer; import flash.di...

get current instance of class in PHP

how do i get access to a current instance of class that's already running in PHP? in my one PHP class, I want to call a function from another that's already running as a server. so i cant create a new instance. thanks. p a ...

Exception in thread "main" java.lang.ClassCastException:

Hello All, I have been using a driver to test one of my data structures(Binary Search Tree) and i have come across this issue. -It happens when i insert more than 2 objects into the bst -What I am trying to do: I am inserting 4 objects into the tree, then i am deleting 2 objects, and then printing out my find method so that it displays ...

While in a Class to Show Posts

i have a class lets call it page and it retrieve somw rows from database (array) and returns them. i want somthing like this: when a class called in a div (<div> $posts->show()</div>) like wordpress and other CMSs i want the div to be looped.i mean like <div>1</div><div>2</div><div>3</div><div>4</div> within the class. ...

Call Dialog Methods form a static Class in C#

I have to catch an event from a parent dialog that uses a method from a static class to update an array. From this dialog I call a child dialog that shows the array in a list. I know with a variable if the current dialog is the child or the parent dialog, but from the method in the static class how can I call the method inside the chil...

Does Java guarantee that Object.getClass() == Object.getClass()?

I really do mean identity-equality here. For example, will the following always print true. System.out.println("foo".getClass() == "fum".getClass()); Thanks in advance, ~Mack ...

Overriding a Sub procedure in VB.NET

I have a main class that has a Sub procedure with no implementation. Any derived class should override and implement this procedure, so I used MustOverride in the base class. Now, any time this procedure is called, I need to set a specific Boolean variable to True at the beginning of the procedure and set it to False at the end. Is the...

Android: Error inflating class

Hello, I'm new to Android development and I've been having an issue that I haven't been able to fix. I'm mostly using code from examples provided in the SDK so I'm not sure what's happening here. I'm simply trying to create a custom view GhostSurfaceCameraView that extends SurfaceView. Here's my class definition file GhostSurfaceCameraVi...

Organising classes - Best practice?

A quick question about best practice with PHP classes. I have seen people use filenames such as something.class.php to organise their classes in external files. So, is it best practice to have one file per class, or multiple classes per file. At the moment, I am scripting an RPG and have a single class_lib.php file. I currently have ju...

Should method/class comments be consistently applied or on a need basis only?

For consistency, I've always applied comments (in the form of a JavaDoc) to all methods and classes, even if they are simple getters and setters methods or very small wrapper classes. But I'm also striving to write self-documenting code which often makes comments superfluous; i.e. write comments only where needed (and before doing that, ...