0
votes
2answers
30 views

Execute private function inside the class by its name (string)

At the moment I have simple JavaScript class like this: function MyClass() { // ... some code ... this.Create = function() { funcName = 'myTestFunc()'; cTimer = setTimeout(funcName, 1000); } ...
-1
votes
1answer
62 views

The right way of using php class? [closed]

$GLOBALS['IPv4_Netmask_Map'] = array( 0 => "0.0.0.0", 1 => "128.0.0.0", 2 => "192.0.0.0", 3 => "224.0.0.0", 4 => "240.0.0.0", 5 => "248.0.0.0", 6 => ...
0
votes
4answers
42 views

Check user permision in php

How can I create a PHP function or class that checks if a user who is a half-admin (set from a MySQL database) has some rights such as creating a new page, editing, or deleting? I need a function that ...
0
votes
1answer
36 views

PHP - Populating Display Input Data with MySQL Data from Table

I am trying to populate results with a description from my MySQL database table interest_type My private function is private function Get_Interests_Types_From_DB() { $sql = "SELECT ...
0
votes
5answers
47 views

Filter page_id in content display class

I have built a class to display content from database. I want to filter it by page_id now, so I can link content to the right page_id. So i began trying to make it work with $_GET but so far it only ...
0
votes
2answers
40 views

PHP - Calling Private Function within the Class Displaying MySQL Data

I have a class Club{} that has several public functions and private functions. The three private functions I have are used to get data from my database. Here is the following code: private function ...
0
votes
0answers
30 views

Python. I want to be able to define the current position of my cursor and the position of my last left mouse click. [duplicate]

I want to be able to define the cursor position of the last left mouse click as a point and the current cursor position as a point in real-world coordinates. The code I have so far has the Tkinter ...
-8
votes
4answers
87 views

What does “::” mean in c++? [duplicate]

I have code I am going over that looks like this: foo::foofa(string n){ loadFoo(fn); } What does the foo::foofa mean? I do not quite understand what does :: do? Thanks. EDIT: Also, is there ...
0
votes
1answer
67 views

Form Submission - Using a function within a PHP class to process the form

I am using three files on a project: index.php, class.php, and styles.css. All my functions reside within a php class in the class.php file: <?php class Club { //Private Data private ...
0
votes
3answers
46 views

Call function when class is deleted/garbage collected

I have a class that opens a sqlite database in its constructor. Is there a way to have it close the database when it is destroyed (whether that be due to the programmer destroying it or being ...
-2
votes
2answers
72 views

I need your critics to improve my code. Classes and files manipulation in C++ [closed]

I wrote a code that works fine. I just want extra eyes to highlight every thing that should/could be improved. I have to create a student.dat file, and write data (name, age, gpa of each student) ...
1
vote
4answers
63 views

Attach a method to a class while the class is being created

I've defined two classes as follows: class ClassModel(object): pass class FunctionModel(object): attr = None def __call__(self): return self.attr The idea is to create several ...
1
vote
1answer
38 views

PHP: List of all function Grouped by class

I am looking for a way to get a list of all the php functions but needed them group by the class they exist in. Not sure if there is a way to get this from PHP docs or if its built into PHP. I am ...
0
votes
5answers
102 views

c++ - Call public function with private arguments

In my class: I want to create a public function which has as argument a private member of the class. And be able to call this function from outside of the class. Something like that: class ...
-2
votes
1answer
69 views

calling a function from a class C++

the header file is this: #include "Lib110ct.h" class Circle { protected: double mx, my, mdx, mdy, mradius; public: Circle(){} Circle(double x,double y,double dx,double dy,double ...
-1
votes
2answers
61 views

Understanding Classes and Methods in Python 3

Alright, after viewing a lot of tutorial videos about classes i'm still having trouble understanding them for this assignment i have to do. I need to write a program that essentially does high card, ...
0
votes
2answers
21 views

Getting class param in non-extended form

I have a function, say: public void doWhatever(ExtendedClass class) {} Which the class param is a class, say: public class SomeClass extends ExtendedClass {} How can I get the "SomeClass" name ...
0
votes
2answers
39 views

Correct array_push usage in a class?

I have a PHP class like so: <?php class MyClass { public $my_variable = array(); public function func1() { $var1 = $this->my_variable; array_push($var1, 'var1'); ...
0
votes
1answer
34 views

Calling Non Virtual Method from child class

I know based on polymorphism that you cannot call a non virtual function/method Ex: class Entity { public: Entity() { health = 10; } void DisplayHealth() { std::cout << health ...
0
votes
1answer
160 views

C++11 multiple definitions of class function

RESOLVED: I'm a complete doofus. After pouring through all the files carefully and tracing back through our proprietary dependency file generator, it turns out that there were indeed rogue .cpp ...
0
votes
1answer
28 views

Trying to print 3 types of time: universal, standard, and military (3 files)

#ifndef time_time_h #define time_time_h class time { public: time(); void settime(int h, int m, int s); void printuniversal(); void printmilitary(); void printstandard(); private: int hour; ...
0
votes
2answers
66 views

Returning a class

We just started to study about classes in c++ and I have a little question about returning a class variable in function. Here is the code: #include <iostream> #include <string> using ...
-2
votes
0answers
50 views

When to use member functions vs global functions? [duplicate]

I'm learning C++ through college and I feel like classes are a bit over emphasized. When should code be implemented as a member function as part of a class or as a global function? For example, one ...
0
votes
1answer
39 views

Obtaining information from a returned array - Confusion [PHP]

Afternoon! I've looked around everywhere for an answer to this, I'm attempting to build a site for a company, and they would like a form of check to their external server. I have the class that checks ...
-2
votes
1answer
52 views

How do i call different classes within in a class?

So I made two classes, one making a rectangle and one that makes a star, both being Rectangle() and Star() as there class taking in a specific amount of parameters. My problem is that i have another ...
0
votes
1answer
30 views

requiring template files with classes

Hi I'm trying to make my own simple template system kind of thing and I'm just learning about classes so I'm trying to do it with classes and objects. it works if i put this in top of every document: ...
0
votes
1answer
58 views

Error: no instance of overloaded function, in constructor (C++)

I have a very weird problem... First of all, here are my class's files: Show.h: #ifndef SHOW #define SHOW #include <iostream> #include <string> #include <string.h> class Show { ...
3
votes
1answer
71 views

PHP Function Scope Failure

I am struggling to understand scope and what's preventing my new code from working (assuming it is a scope issue). The following function is in a file PATH.'/includes/custom-functions.php' that ...
0
votes
3answers
63 views

function and classes, usage of __str__

I am having some issues concerning the interaction between functions, methods and have a uncertainty of how to utilize the use of the built-in function __str__. To start this of, I have a class ...
1
vote
4answers
56 views

Creating a function for getting a variable value [duplicate]

Should I prefer getting variable from other class directly(int number = something.number;) or should I use a function for getting that number(like in example below)? What is the difference? class ...
2
votes
1answer
39 views

Ability to access a Text Area from a different class

How would i be able to run this function from my main() to build the gui, and then use code from elsewhere to handle the button click and retrieve input from the text field? package main; import ...
-3
votes
3answers
91 views

C++: Calling private function in a class from the public section of that class

If I were to make a class and place several functions into the private section, how would I call the functions from the public section of the same class? Example: class calculator{ public: //What ...
1
vote
5answers
46 views

Ambiguous call functions in the class

How to get around? I do not want to have functions with different names. public class DataRowSafe { public String Get(String Column) { return String.Empty; } public int ...
0
votes
4answers
67 views

Calling other class function

I have a grid class and a MainWindow class. Grid's class function needs to call MainWindow's function: // function from grid class: public Point functionFromGridClass() { Point ...
1
vote
1answer
34 views

Function with object as argument, as argument of another function

I have troubles fixing a little problem I have. I have two classes. One is called MenuBar, in this class there is a vector array of the other object (MenuOption). MenuBar contains a method that create ...
1
vote
1answer
65 views

How to include/require file trough function PHP?

This is tricky to explain but please bare with me , I have 2 files , class.inc.php and index.php class.inc.php contains Myclass and few functions , index.php file spits out functions from ...
1
vote
5answers
101 views

How to pass method of a class into another function in C++?

Say I have a class and a function class A { int a; int b; void mul(); }; ... void func(int af, int bf, void (*fc)()) { ... } In the main function, the function is supposed to use ...
-1
votes
1answer
195 views

Function returning string in C++ [closed]

The following program is to get an account number input by the user, using class, which is of a predefined format - first two are alphabets, next three digits are the branch code and the remaining ten ...
3
votes
4answers
80 views

C++: “unresolved overload function type” between classes

This is probably something elementary, I have a function from one class (called cell) with identifier woo_func_ptr taking a pointer to function of type void with no arguments (void (*void_ptr)(void)) ...
5
votes
2answers
69 views

Should I break down codes into as many functions as possible? [closed]

Lets say I have a function that logs in a user in pseudo code def login(): # find user in db # check if user exists # check password # login user Should each action be its own ...
1
vote
1answer
88 views

Calling a function from another class - XNA 4.0 - C#

Basically I am trying to implement a save function into my game. When you click save in the menu, the game writes to a .txt file. From the MenuManager class I want to call a function within Game1.cs ...
2
votes
2answers
41 views

Calling a function within my class isn't working

class MyClass(object): def f(self): return 'hello world' Everything i have been reading here and on other websites that with this code, if i run MyClass.f() it should return with hello ...
0
votes
2answers
61 views

Php create class function to retrieve data from table

I'm new learner in php OOP, I want to create a class function to get register users info, how can I do that? class Functions{ public static function getUserInfo($user_id){ $sql = ...
0
votes
6answers
71 views

mysql select * or desired parameters in php function

I have a function which selects the * values from a particular table, I need to configure that if I pass * in parameter then it selects all or the selected parameters. My function is as follows: ...
0
votes
1answer
26 views

WordPress $wpdb->options returns blank

I am working on a WordPress theme and trying to use the $wpdb class from within my own theme class. When I try to use the following SQL query the $wpdb->options variable is blank and generates an ...
0
votes
3answers
62 views

c++ dynamical array in class

I'm programming a hotel program that contains array //size of array is number of rooms in that hotel //array[i] contains people in room i, max is 3 people everything works perfectly ...
-3
votes
1answer
40 views

Why do all of the member functions have to be template functions in a template class? [closed]

When you have a template class, why do all of the member functions have to be template functions, even if that member function does not access one of the template member variables?
0
votes
0answers
56 views

How to make a function in one class implement another class?

I am creating a GUI with a code like this: class MyClass2(QtGui.QMainWindow): def __init__(self, win_parent = None): def on_blahblah_clicked(x): if __name__ == ...
1
vote
2answers
30 views

Accessing and changing an element outside a previously modifyied element

When clicking on an image, the image source should change, as well as the class of the matching span. HTML: <span class="oldClass"> Some Text <img id="IdForThisImg" ...
-2
votes
7answers
111 views

PHP call Class method / function

How can I call following Class method or function? Let say I have this params get from url: $var = filter($_GET['params']); Class: class Functions{ public function filter($data){ ...

1 2 3 4 5 13
15 30 50 per page