class

Delphi: Calling a function from a vc++ dll that exports a interface / class

跟風遠走 提交于 2020-02-02 12:52:18
问题 i have some trouble accessing a dll written in vc++ that exports an interface. First i tried to use classes, but after some google-search i came to the solution, that this i not possible. I just want to make sure, that the plugin interface can accessed, by using other languages like c++. Delphi Interface IPlugIn = interface function GetName: WideString; stdcall; end; Delphi Plugin call procedure TForm1.Button5Click(Sender: TObject); var hLib: Cardinal; MLoadPlugIn: TLoadPlugIn; PlugIn:

understanding virtual copy constructors

僤鯓⒐⒋嵵緔 提交于 2020-02-02 05:42:08
问题 I'm having trouble understanding what's really happening with the code in a book I'm using to learn C++. Here's the code: class Base { public: Base() {}; virtual ~Base() {}; virtual Base* Clone() {return new Base(*this);} }; class Derived { public: Derived() {}; virtual ~Derived() {}; virtual Base* Clone() {return new Derived(*this);} }; So in this Clone() function I understand that the function returns a pointer to a Base class object. What I don't understand is what's happening within that

Android阶段性学习总结_2_Activity的生命周期、跳转方式及参数传递、启动模式。

馋奶兔 提交于 2020-02-01 22:35:49
Activity的生命周期: onCreat ,onStart,onResume,onPause,onRestart,onStop,onDestroy Activity之间的跳转分为显式跳转和隐式跳转。 隐式跳转: Intent intent=new Intent(); intent.setAction("android.intent.action.BAcivity"); startActivity(intent); 显式跳转: Intent intent=new Intent(AActivity.class,BActivity.class); //intent.setClass(class,class) //intent.setClassName(class,"class url"); 参数传递: Bundle bundle=new Bundle(); bundle.putString("string","---hahaha---"); intent.putExtras(bundle); startActivity(intent); 需回传参数的参数传递: AActivity: Intent intent=new Intent(Activity.this,BActivity.class); Bundle bundle=new Bundle(); bundle.put__(tag

hadoop2.2.0的WordCount程序

南楼画角 提交于 2020-02-01 09:07:45
package com.my.hadoop.mapreduce.wordcount; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.GenericOptionsParser; /** * MapReduce中的WordCount * @author yao * */ public class WordCount

Methods for Python classes representation

不羁岁月 提交于 2020-02-01 04:33:25
问题 I know that methods __repr__ and __str__ exist to give a formal and informal representation of class instances. But does an equivalent exist for class objects too, so that when the class object is printed, a nice representation of it could be shown? >>> class Foo: ... def __str__(self): ... return "instance of class Foo" ... >>> foo = Foo() >>> print foo instance of class Foo >>> print Foo __main__.Foo 回答1: When you call print(foo) , foo 's __str__ method is called. __str__ is found in the

java中Map转化为bean

微笑、不失礼 提交于 2020-01-31 18:20:15
  Map 集合类用于存储元素对(称作“键”和“值”),其中每个键映射到一个值,在java编程中会经常用到。但是当我们进行业务逻辑的处理或着操作数据库时,往往应用的是我们自己定义的的Bean或VO来传递和存储数据,这就需要我们应用一个公共方法来将map中存储的数据转换为相对应的Bean或VO,主要用到java中反射技术。   以下为本人在项目中用到的工具类,它囊括了我们常用的数据类型,代码如下: package test; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; //Map转化为bean public class MapToVoUtil { public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); public static <T> Object refelctBean(Map map ,

List all methods of a given class, excluding parent class's methods in PHP

筅森魡賤 提交于 2020-01-31 08:21:37
问题 I'm building a unit testing framework for PHP and I was curious if there is a way to get a list of an objects methods which excludes the parent class's methods. So given this: class Foo { public function doSomethingFooey() { echo 'HELLO THERE!'; } } class Bar extends Foo { public function goToTheBar() { // DRINK! } } I want a function which will, given the parameter new Bar() return: array( 'goToTheBar' ); WITHOUT needing to instantiate an instance of Foo. (This means get_class_methods will

List all methods of a given class, excluding parent class's methods in PHP

人盡茶涼 提交于 2020-01-31 08:20:08
问题 I'm building a unit testing framework for PHP and I was curious if there is a way to get a list of an objects methods which excludes the parent class's methods. So given this: class Foo { public function doSomethingFooey() { echo 'HELLO THERE!'; } } class Bar extends Foo { public function goToTheBar() { // DRINK! } } I want a function which will, given the parameter new Bar() return: array( 'goToTheBar' ); WITHOUT needing to instantiate an instance of Foo. (This means get_class_methods will

How to initialize a unique_ptr

别等时光非礼了梦想. 提交于 2020-01-31 06:16:25
问题 I'm trying to add a lazy-initialization function to my class. I'm not very proficient with C++. Can someone please tell me how I achieve it. My class has a private member defined as: std::unique_ptr<Animal> animal; Here's the original constructor that takes one parameter: MyClass::MyClass(string file) : animal(new Animal(file)) {} I just added a parameter-less constructor and an Init() function. Here's the Init function I just added: void MyClass::Init(string file) { this->animal = ???; }

How to initialize a unique_ptr

天大地大妈咪最大 提交于 2020-01-31 06:16:13
问题 I'm trying to add a lazy-initialization function to my class. I'm not very proficient with C++. Can someone please tell me how I achieve it. My class has a private member defined as: std::unique_ptr<Animal> animal; Here's the original constructor that takes one parameter: MyClass::MyClass(string file) : animal(new Animal(file)) {} I just added a parameter-less constructor and an Init() function. Here's the Init function I just added: void MyClass::Init(string file) { this->animal = ???; }