Pascal中的BigInteger(BigInteger in Pascal)
Free Pascal中是否存在BigInteger类型? 在Java和C#中存在BigInteger和BigDecimal类型。 我如何在Pascal中编写我用Java编写的相同代码:
package bigint; import java.math.BigInteger; /** * @author Istvan */ public class bigint { public static void main(String[] args) { BigInteger a = new BigInteger("12345678913546876542545054683656469434"); BigInteger b = new BigInteger("983435472457463464685743648468650354684046846841"); BigInteger c = a.multiply(b); System.out.println("c="+c); } }
Is there BigInteger type exists in Free Pascal? In Java and C# exists the type BigInteger and BigDecimal. How can I write the same code I have written in Java below in Pascal:
package bigint; import java.math.BigInteger; /** * @author Istvan */ public class bigint { public static void main(String[] args) { BigInteger a = new BigInteger("12345678913546876542545054683656469434"); BigInteger b = new BigInteger("983435472457463464685743648468650354684046846841"); BigInteger c = a.multiply(b); System.out.println("c="+c); } }
原文:https://stackoverflow.com/questions/18048142
更新时间:2023-04-30 07:04
最满意答案
这被称为最棘手的解析问题 。
ClassA item(ClassB(name));
应该是:
ClassB b(name); ClassA item(b);
要么:
ClassA item( (ClassB(name)) );
另外看看: 最令人头痛的解析:为什么不A a(()); 工作?
This is called most vexing parse problem.
ClassA item(ClassB(name));
should either be:
ClassB b(name); ClassA item(b);
or:
ClassA item( (ClassB(name)) );
Also have a look at: Most vexing parse: why doesn't A a(()); work?
相关问答
更多-
如果A是一个类,可以通过A::$strName直接访问它。 class A { public static $strName = 'A is my name'; } echo A::$strName; // outputs "A is my name" 更新: 根据你在数组中的内容,不管它是我喜欢定义的类对象还是类文字都可能是一个因素。 我通过这两个术语来区分, $objClasses = array(new A(), new B()); // class objects $myClasses ...
-
您需要通过创建引用它的局部变量来扩展其范围,如下所示: function a_class_a_function() { var self = this; AFunctionThatTakesACallback(function() { console.log(self.a_var); }); } 你需要这样做的原因是因为AFunctionThatTakesACallback函数中的this引用与当前对象不同,它可能会引用全局window对象。 (通常不是你想要的)。 哦,我 ...
-
你必须知道如何调用这些方法。 ex::show(); (...) obj->show(); 是(通常可能)由您的特定编译器翻译为: show(ex * this); (...) show(obj); 因为你不在里面使用this ,所以没有理由抛出异常...... 我强调了你的特定编译器 ,因为: C ++标准,第8.3.2章,参考文献 [注意:特别是,在一个定义良好的程序中不能存在空引用,因为创建这样一个引用的唯一方法是将它绑定到通过空指针间接获得的“对象”,这会导致未定义的行为 。 如9.6中所述 ...
-
这被称为最棘手的解析问题 。 ClassA item(ClassB(name)); 应该是: ClassB b(name); ClassA item(b); 要么: ClassA item( (ClassB(name)) ); 另外看看: 最令人头痛的解析:为什么不A a(()); 工作? This is called most vexing parse problem. ClassA item(ClassB(name)); should either be: ClassB b(name); Cla ...
-
你使用点: inst.staticmember ::仅用于命名空间或类,正如您可能从编译器错误中看到的一样。 您可以通过两种方式访问静态成员变量:通过classy::staticmember其中classy是一个类,或者inst.staticmember ,其中inst是一个类实例。 You use the dot: inst.staticmember :: is only for use with namespaces or classes, as you may have discerned fro ...
-
Static Cast访问静态const类成员[duplicate](Static Cast to access static const class member [duplicate])[2022-04-09]
类中static成员的声明,如static const int test = 5; 是一个声明但不是定义,即使它有一个初始化器。 声明通常应该有相应的定义。 这个定义看起来像const int A::test; (这不是“前瞻性声明”。) 但是,还有一个额外的规则,即如果只使用其值,不使用其地址,并且没有引用绑定到它(这与获取其地址类似),则不需要定义整数类型的static const类成员。 你正在调用的函数是void std::vector::push_back(const int&); 。 ... -
forEach有一个可选的thisarg你可以在传递回调后传递,所以这应该工作: MyClass.prototype.foo = function(){ var arr = [1, 2, 3]; var myCurrentInstance = this; //Store temporary reference arr.forEach(function(element){ //Here it works because I use the temporary re ...
-
你不能做$this->class::create() 。 如果你想访问一个静态成员,你必须使用Class::Member 。 Zend PHP解析器的当前实现仅支持直接在类名或变量上进行的静态方法调用。 这是语法: %token T_PAAMAYIM_NEKUDOTAYIM ":: (T_PAAMAYIM_NEKUDOTAYIM)" function_call: name argument_list { $$ = zend_ast_create(ZEND_AST_CALL, $1, ...
-
从C#5规范,第3.5.3节: 当在声明它的类的程序文本之外访问受保护的实例成员时,并且在声明它的程序的程序文本之外访问受保护的内部实例成员时,访问必须在类中进行声明派生自声明它的类。 此外,访问需要通过该派生类类型的实例或从其构造的类类型进行。 此限制可防止一个派生类访问其他派生类的受保护成员,即使这些成员是从同一基类继承的。 所以你可以访问任何NodeDerived对象的Parent属性: NodeDerived derivedNode = ...; Node parent = derivedNode. ...
-
我无法从另一个成员函数中读取成员变量[重复](I can't read a member variable from within another member function [duplicate])[2021-12-24]
它正在发生,因为xhrObj函数onreadystatechage本质上是异步的,当它在完成调用后返回时, onreadystatechage()内部的上下文不同,因此this.xhrObj没有区别。 It is happening because xhrObj function onreadystatechage is asynchrous in nature and when it return after complete call this context is different inside t ...