class

[C++] Parent-Child scheme

I'm writing a class that holds a pointer to a parent object of the same type (think Qt's QObject system). Each object has one parent, and the parent should not be destroyed when a child is destroyed (obviously). class MyClass { public: MyClass(const MyClass* ptr_parent): parent(parent){}; ~MyClass(){ delete[] a_children; }; priv...

iPhone - Launching selectors from a different class

Hi, I'd like to reload a table view which is in another class called "WriteIt_MobileAppDelegate" from one of my other classes which is called "Properties". I've tried to do this via the NSNotificationCenter class - the log gets called but the table is never updated. Properties.h: [[NSNotificationCenter defaultCenter] postNotification...

[iphone] method created in a seperate class returns "out of scope"

Hey, I have created a Class (subclass of NSObject) which will hold all my SQLs/dbConnections etc.. in a seperate viewcontroller, i have instantiated the SQL's class and performed some actions, all went trough OK. but. one of my methods in the SQL's class is a method defined as follows: -(NSString *)queryTable:(NSUInteger *)fieldnum ...

Class DIagram Aggregation

Hi, i came across this definition Aggregation has two properties: antisymmetry, transitivity What does it mean? thanks ...

Accessing initialized variable on different class C++

I'm having some difficulties with this problem. The main idea is, I initialized a variable of class type B in class A, class A.h has the variable Z declared as public, like B *Z; In class A.cpp, I initialized it as Z = new B(); Now, I want to access that variable from class C and I'm unable to do so. C.h includes A.h and B.h Here goe...

How to loop through an array return from the Query of Mysql

This might be easy for you guys but i could't get it. I have a php class that query the database and return the query result. I assign the result to an array and wants to use it on my main.php script. I have tried to use echo $var[0] or echo $var[1] but the output are 'array' instead of my value. Anyone can help me about this issue? Th...

Accessing variables in other classes (Java)

Why doesn't the following program return 0, since I am accessing p from a new A(), which has not had main called on it? public class A { public static int p = 0; public static void main(String[] args) { p = Integer.parseInt(args[0]); new B().go(); } } c...

C++ Basic Class Layout

Learning C++ and see the class laid out like this: class CRectangle { int x, y; public: void set_values (int,int); int area () {return (x*y);} }; void CRectangle::set_values (int a, int b) { x = a; y = b; } I know Java and methods(functions) in Java are written within the class. The class looks like a Java interface...

Are classes in Python in different files?

Much like Java (or php), I'm use to seperating the classes to files. Is it the same deal in Python? plus, how should I name the file? Lowercase like classname.py or the same like ClassName.py? Do I need to do something special if I want to create an object from this class or does the fact that it's in the same "project" (netbeans) mak...

how do i call a java file on click in another java class?

hi, i have two files App.java Gallery.java App. java contains frontend buttons and functionalities Gallery.java lists the imagesin the sd card i want to call Gallery.java in click event in app.java App.java package gallery.display; import android.app.Activity; import android.os.Bundle; import android.view.View.OnClickListener; ...

C# Inherited member variables behaving undexpectedly

If I have a class like this: class A { public string fe = "A"; } And a class that inherits from it like so: class B : A { public string fe = "B"; } Visual C# will tell me that B.fe hides A.fe so I should use the new keyword. So I change class B to look like: class B : A { public new string fe = "B"; } And then I have...

Class library compiled .DLL .NET

Im trying to compile a simple class library project,its from Source Safe. However,when i "build" project,then right click on project's BIN --> DLL --> Choose Properties,the Date modified doenst change,and i dont know if the DLL was recompiled with the new version. Any ideas? ...

php class crash course

I'm going crazy trying to write my first php class; it is supposed to connect me to server and to a database but I'm always getting this error: Parse error: syntax error, unexpected ',', expecting T_PAAMAYIM_NEKUDOTAYIM in /Applications/XAMPP/xamppfiles/htdocs/classTest/test.php on line 9 Thanks in advance, here is the code: <?php // ...

How do i get (is it possible to) a reference to the class that creates an instance of another class.

Odd situation... I need to create a new instance of a class that needs a member of the calling class. But i can't pass a reference to the calling class through the constructor. The solution i am looking for is something like this: Public Class ChildClass Public Sub New(args) _MyMember = GetMemberFromCallingClass() ....

Get Instance ID of an Object in PHP

I've learn a while ago on StackOverflow that we can get the "instance ID" of any resource, for instance: var_dump(intval(curl_init())); // int(2) var_dump(intval(finfo_open())); // int(3) var_dump(intval(curl_init())); // int(4) var_dump(intval(finfo_open())); // int(5) var_dump(intval(curl_init())); // int(6) I need something simi...

Pointing class property to another class with vectors

I've got a simple class, and another class that has a property that points to the first class: #include <iostream> #include <vector> using namespace std; class first{ public: int var1; }; class second{ public: first* classvar; }; Then, i've got a void that's supposed to point "classvar" to the intended iteration of the clas...

Elements with a Div having a specific class name

Hi How can I get hold of elements within a Div that uses a class say "sample"? There are many Div's in the document <div class="sample"/> .. <div class="sample"/> .. <div class="sample"/> .. <div id = "samplediv"> <div class="sample"> <div> </div> My question was to find the div with class sample and manipulate some properties of...

Array in element of object

Why in example 'mytest' isn't an array? class myclass { public $mytest = array(); } $insert = new myclass; $insert -> mytest = Array (15, 50); ...

What are the naming conventions and other standards used while developing a class in php?

I am pretty new to PHP classes and I want to follow the standard pattern? ...

What are the benefits of a classical structure over a prototyple one?

I have only recently started programming significantly, and being completely self-taught, I unfortunately don't have the benefits of a detailed Computer science course. I've been reading a lot about JavaScript lately, and I'm trying to find the benefit in classes over the prototype nature of JavaScript. The question seems to be drawn dow...