小编aUs*_*elf的帖子

在 GAC 中注册 DLL(CMD 或 PowerShell)

我正在尝试.DLLGAC. 目前我无法证明它已添加到程序集中。

使用命令

C:\Windows\System32>%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe -i "path\to\my\file.dll"

提示告诉我程序集已添加到缓存中。

检查时

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>gacutil.exe -l file.dll

它说程序集中有 0 个元素。

通过Powershell命令,我试图添加DLL这样的:

PS C:\WINDOWS\system32> Add-Type -AssemblyName "System.EnterpriseServices"

PS C:\WINDOWS\system32> $publish = 新对象 System.EnterpriseServices.Internal.Publish

PS C:\WINDOWS\system32> $publish.GacInstall("file.dll")

我做错了什么?我怎样才能将.DLL加到GAC?最好的方法(对我来说)是用Powershell.

windows dll powershell gac

3
推荐指数
1
解决办法
2万
查看次数

C++ 输入运算符重载 >>

我有一个名为的基本类BankAccount,如下所示:

class BankAccount {
    private:
        char* accountId;
        int* ownerId;
        double* accountBalance;
    // some other methods here...
}
Run Code Online (Sandbox Code Playgroud)

我的问题是关于使用输入运算符创建对象。我观察到,当我使用它时,实际上创建了 2 个对象,因为析构函数最终被调用了两次:

1. The implicit constructor is called
2. The values for initializing the object are provided from the stdin
3. The copy constructor is called
4. The destructor is called twice
5. The object is printed to the stdout
Run Code Online (Sandbox Code Playgroud)

你能解释一下它是如何工作的吗?它是否可以避免?我想参数bankAccount是直接修改的。

我的职能是:

// 3. input operator
friend istream &operator>>(istream &in, BankAccount &bankAccount ) {
    cout << "Enter the …
Run Code Online (Sandbox Code Playgroud)

c++ operator-overloading istream

1
推荐指数
1
解决办法
1606
查看次数

将值初始化为构造函数

在下面的代码中,我已经声明了2个用户定义的构造函数,一个没有参数,另一个带有3个参数,在构造函数中我将值赋给实例变量,当执行main方法时,不带参数的构造函数的输出是2并且具有3个参数的构造函数的o/p在第一种方式中为0,但是当我尝试第二种方式时,零参数构造函数的o/p为2,而对于3参数,构造函数为15,其中我传递参数而对象创建,现在我不明白为什么在第一种方式输出为零.

public class Main {

    int x, y, z;

    Main() {
        x = 2;
        y = 2;
        z = 2;
    }

    // first way
    Main(int x, int y , int z) {
        x = 20;
        y = 20;
        z = 10;
    }

    // second way
    Main(int x, int y , int z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    public int sub() {
        int m;
        m = x + y - z;
        System.out.println("the value is " …
Run Code Online (Sandbox Code Playgroud)

java variables constructor instance

0
推荐指数
1
解决办法
66
查看次数