class

Why do calls to Class Module Private Subs fail when using `Me`? [duplicate]

﹥>﹥吖頭↗ 提交于 2020-01-17 12:56:43
问题 This question already has answers here : Why can't the VBA Me keyword access private procedures in its own module? (5 answers) Closed 5 years ago . When using a Class Module in VBA, how come a call to a Private Sub will fail when using Me in front of it, but a call to a Public Sub is OK? For example, the code below (not a full Class Module, just a snippit) produces the error Method or data member not found or the line Call Me.SetupQuote . However, if I make SetupQuote() a Public Sub all is

c++笔记3

为君一笑 提交于 2020-01-17 07:09:44
1: 友元函数:当一个全局函数作为一个类的友元函数时(class P{ friend void fun();…}),该全局函数可以访问该类的私有成员变量。 友元类:当一个类作为另一个类的友元类时,则友元类可以访问该类的私有成员(class P{friend calss Q;}) 成员函数作为友元:当一个类中的一个成员函数作为另一个类的友元函数时,该友元成员函数可以访问该类的私有成员(class P{friend void Q::fun();}) 2: 加号运算符重载: a:全局函数实现+号运算符重载(Person operator+(const Person& p1,const Person& p2){…;return temp;} ) b:成员函数实现+号运算符重载(class Person{Person operator+(const Person& p1,const Person& p2){…;return temp;} }) 3:继承权限: 注意: a:父类中所有非静态成员属性都会被子类继承下去,父类中的私有成员只是被编译器给隐蔽起来 b:创建子类对象时,先运行父类构造函数,再运行子类对象构造函数,子类对象析构,父类析构 c:子类对象可以直接访问自身与父类同名的成员变量、函数,如访问父类中的变量、函数需要加作用域(son.Bass::fun();) d:多继承语法

get index of class element with inline onclick - pure js no jQuery

强颜欢笑 提交于 2020-01-17 06:46:46
问题 so i have some class-elements: <span class="show" onclick="show()">show</span> <span class="show" onclick="show()">show</span> <span class="show" onclick="show()">show</span> when i click one of these elements i need the index for some reason. i know how to use jQuery, but thats not what i am asking for, here. my js function should look something like this: function show() { var index = document.getElementsByClassName('show')[??]; alert(index); } How is that possible with pure javascript?

Creating a function on a parent class that can be accessible to all it's child classes

痴心易碎 提交于 2020-01-17 05:51:32
问题 I'm trying to create a function in a parent class that can be accessible to it's child classes. The issue I'm having is part of the function is referring to an init that needs to happen in the child class. I get an error: Argument passed to call that takes no arguments I'm not completely sure how to make the function available to it's child classes without copy and pasting it inside each child class. Here is the parent class: class JSONObject: NSObject { static func updateResultsDictionary

Accessing static field from Class<A> variable

孤街醉人 提交于 2020-01-17 05:09:31
问题 I have the following situation (I know it doesn't sound real but I simplified it for better understanding): A class A , with a public static int f; declared Other classes B, C, D, ... that extend A A method foo (somewhere else, doesn't matter) with the following signature: int foo(Class< A> classz); Now I want this method implementation to return the value if the static field f , from the class represented by classz ; subclasses of A may have different values. I don't want to use reflection

Calling variables from class (DateTime)

可紊 提交于 2020-01-17 04:40:09
问题 I need to call my datetime variable from another class, this is the code for querying with date condition static DataTable GetCustomerRecords(DateTime date, DateTime date2) { var connSettings = ConfigurationManager.ConnectionStrings["MyDB"]; { string CN = connSettings.ConnectionString; MySqlConnection conn = new MySqlConnection(CN); MySqlCommand cmd = new MySqlCommand("select value1, value2, value3, date2 from dummy table where date1 >= CAST(@startDate AS DATE) and date2 <= CAST(@endDate AS

Get object name of a class from the user in Java

自闭症网瘾萝莉.ら 提交于 2020-01-17 03:09:08
问题 I want the user to enter the name of the object to be used in the code. For example, if I have a class public class Person{ ....... } now instead of me creating an object with a specific name like Person student; I want the user to enter the name for the object maybe like teacher, and then an object teacher of the class person will be created. I do not know if this is even possible in java, many of the solutions I looked up were using a map, but the explanations were not clear enough for me

Instantiating all possible combinations of enums

好久不见. 提交于 2020-01-17 02:54:48
问题 I'm having trouble iterating over all possible combinations of enums. I'm not too familiar with them as I've just started C# and am coming in from low level languages like C and assembler. public enum enumA { A1, A2, A3 } public enum enumB { B1, B2, B3 } public class foo { private enumA enumAfoo; private enumB enumBfoo; public foo() { } public foo(enumA A, enumB B) { enumAfoo = A; enumBfoo = B; } } public class fooTwo { private List<foo> allCombinations = new List<foo>(); public fooTwo() { }

Beginner python error - no attribute found

北慕城南 提交于 2020-01-17 01:23:28
问题 I have this class bgp_route: class bgp_route: def _init_(self, path): self.nextHop = None self.asPath = '' self.asPathLength = 0 self.routePrefix = None However, when I run the following test code; from bgp_route import bgp_route testRoute = bgp_route() testRoute.asPath += 'blah' print testRoute.asPath I get the following error: Traceback (most recent call last): File "testbgpRoute.py", line 6, in <module> testRoute.asPath += 'blah' AttributeError: bgp_route instance has no attribute 'asPath'

What is the best way to pass or access other objects in other classes in PHP?

余生颓废 提交于 2020-01-16 21:59:44
问题 I need some help in planning out how to do my classes in PHP. I have a session class and a database class that I pretty much need to access inside of every other class I use (forums, mail, users, lots more classes) So I am looking for how I should access the session class inside of my other classes, 1 option is to make it GLOBAL, another is to pass $session and $database objects into every class I use like this... $mail = new Mail($session, $database); but this seems pretty tedious if I have