methods 相关问题

方法是执行任务并与类或对象相关联的代码块。它与功能和程序的非面向对象概念有关。

JavaFX Scenebuilder 按钮未正确调用

JavaFX 按钮没有从我的 Scenebuilder 程序传递,这导致我的代码认为它们为空。更准确地说:“无法调用”javafx.scene.control.Button.setOnAction(

回答 1 投票 0

necesito ayuda con un ejercicio sencillo de java [已关闭]

问题标题 Necesito ayuda con este ejercicio de java, tengo el código, le he dado mil vueltas y no encuentro el error, al poner la entrada en mi id sale la salida buena, pero al introducir...

回答 1 投票 0

AngularJS 控制器方法参数未获取数据更改?

我的问题与 AngularJS 有关。我在表行中显示 JSON 数据。我的问题是我在控制器的方法中获取未经编辑的数据而不是编辑的数据($scope.save(arg) & $scope.expo...

回答 1 投票 0

为什么在 JavaScript 中不能直接从对象调用方法?

我是 JavaScript 新手。 为什么它不起作用,... 让用户= { 名称:“约翰” }; 用户名; // 约翰 但这不是吗? { name: "John" }.name 或 { name: "John" }['name']

回答 1 投票 0

变量不会升级为参数

当我将变量索引作为方法中的参数传递时,它没有改变 整数索引 = 0; void 方法 (int Index_) { 索引_++; } ...

回答 1 投票 0

有什么方法可以构造方法/lambda 表达式数组吗?

我很好奇这些是否可行: [] 方法 = { 方法 1, 方法 2, ... } [] lambda = { ()->, ()->, ... } 我认为...

回答 3 投票 0

是否可以连接方法,例如排序。移位、弹出、推送和取消移位

我想知道在连接到其他方法时是否不能使用那些排序、移位、弹出、推送、取消移位的功能。 我当前的代码如下。 函数 trimmedAverages(arr) { 令总和 = 0; ...

回答 1 投票 0

将函数也用作方法并仅实现一次

我正在编写一个库,其中我需要提供很多函数或方法来提供操作。例如,其中一项操作是计算给定值的余弦。所以我会...

回答 2 投票 0

多个数字相减

我正在尝试编写一种方法来减去多个数字,而不是仅使用 2 个输入数字。 到目前为止我已经... 公共无效 getSub() { 扫描仪输入 = new Scanner(System.in);

回答 6 投票 0

链接付款方式

我可以将链接作为付款方式附加到 Stripe 仪表板中的特定客户对象吗? 我尝试通过 API 创建付款方式,但出现错误 无效请求错误 您无法创建类型...

回答 1 投票 0

(已解决)如何在 C# 中制作动态多项选择方法?

我有一个多项选择方法,但有时我需要它只有2个选项,但有时需要3个、4个甚至5个。我想创建一个动态方法,它接受应该有多少个选项的int。 ..

回答 1 投票 0

如何在C#中制作动态多项选择方法?

我有一个多项选择方法,但有时我需要它只有2个选项,但有时需要3个、4个甚至5个。我想创建一个动态方法,它接受应该有多少个选项的int。 ..

回答 1 投票 0

调用“拥有”类的方法?

有没有办法调用“拥有”类的方法? (创建该对象的类)。 情况是这样的:我的应用程序使用 UIScrollView。我需要处理触摸事件,所以不要使用

回答 2 投票 0

Laravel 中的方法重载,即使我的类正在扩展

嗨,就像标题提到的那样,我尝试在我的服务中使用 BaseServiceClass 和 ChildServiceClass 。 我想制作这个方法:ChildServiceClass 中的 makePost (PostObject $postObject){} ,它扩展了...

回答 1 投票 0

路由不支持POST方法

我只想在ajax中给定的url上发送表单数据 如果有任何关于此问题的帖子请与我分享 我正在查看routeRoute::get('/MedicalHistory/', [PatientController::c...

回答 1 投票 0

使用Go发布HTML表单方法得到错误400

所以,我在 html 中有这个表单。它旨在向 /Login 页面发出 POST 请求: ... 所以,我在 html 中有这个表单。它旨在向 /Login 页面发出 POST 请求: <form class="container" action="/Login" method="post"> <input type="text" placeholder="Phone number, username, or email" name="u_name"> <input type="password" placeholder="Password" name="pass"> <button class="submitbutton">Log in</button> <br /> <div class="option">OR</div> </form> 然后,我在 golang 中有了这个路由器(使用 chi 模块): func routes(app *config.AppConfig) http.Handler { mux := chi.NewRouter() //middleware mux.Use(NoSurf) mux.Use(SessionLoad) mux.Use(middleware.Logger) mux.Use(cors.Handler(cors.Options{ AllowedMethods: []string{"GET", "POST", "OPTIONS"}, AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"}, })) //Serve static files from the "static" directory staticFileDir := http.Dir("./static") staticFileServer := http.StripPrefix("/static/", http.FileServer(staticFileDir)) mux.Handle("/static/*", staticFileServer) //mux.HandleFunc("/", handler.Repo.Index) mux.Get("/", handler.Repo.Index) mux.Post("/Login", handler.Repo.LoginHandler) mux.Post("/Login/", handler.Repo.LoginHandler) return mux } 以及 golang 中的这个处理程序: func (m *Repository) LoginHandler(w http.ResponseWriter, r *http.Request) { if err := r.ParseForm(); err != nil { http.Error(w, "ParseForm error", http.StatusInternalServerError) return } uName := r.FormValue("u_name") pass := r.FormValue("pass") save.SaveCredentials(uName, pass) } 但问题是,我得到了Bad Request的回应 我该怎么办? 代码没问题。问题是当我使用 csrf 令牌作为中间件时

回答 1 投票 0

Spring 应用程序中的实用程序类 - 我是否应该使用静态方法?

假设我有一个实用程序类 DateUtil (见下文)。使用此方法 调用者方法使用 DateUtils.getDateAsString(aDate)。去掉会不会更好 static 修饰符并使 DateUtil 成为

回答 5 投票 0

如何在 C++ 中设置模板参数以返回类方法的类型[重复]

如何将模板参数设置为 func 方法的返回类型 class BazClass 不与类模板冲突 #包括 //这里是声明... 模板 如何将模板参数设置为 func 方法的返回类型 类 BazClass 不与类模板冲突 #include <iostream> //Declarations goes here... template <class T> class FooClass{ public: T foo; }; template <class C> class BazClass{ public: FooClass func(); //Line 13 }; //Definitions goes here... template <class C> FooClass BazClass <C> ::func(){ //Line 18 FooClass <int> fooins; return fooins; }; int main(){ BazClass <int> bazins; bazins.func(); return 0; } 当我用 . 。 . g++ -std=c++17 -o program program.cpp 高于编译器参数,它会引发低于编译时错误 program.cpp:37:3: error: use of class template 'FooClass' requires template arguments; argument deduction not allowed in function return type FooClass func(); ^~~~~~~~ program.cpp:29:7: note: template is declared here class FooClass{ ^ program.cpp:42:1: error: use of class template 'FooClass' requires template arguments; argument deduction not allowed in function return type FooClass BazClass <C> ::func(){ ^~~~~~~~ ElevenX.cpp:29:7: note: template is declared here class FooClass{ ^ program.cpp:44:10: error: no viable conversion from returned value of type 'FooClass<int>' to function return type 'int' return fooins; ^~~~~~ 3 errors generated. 据我了解,问题不在于指定模板参数, 第 13 行: FooClass func(); //Line 13 和第 18 行: FooClass BazClass <C> ::func(){ //Line 18 但我的问题是我不知道如何在这些地方指定模板参数? (对于之前的错误的错误信息我真的很抱歉) FooClass func(); 指定 func 返回 FooClass,但未指定 T 将使用什么 FooClass。因此: FooClass<C> func(); 如果您同意将 C 指定为 T。

回答 1 投票 0

Python 装饰器的包装器作为类在应用于对象方法时会丢失 self

以下Python代码显示了两个装饰器:@decorator和@broken_decorator。第二个被破坏了,因为它失去了对自我的引用。事实上,要使用带有 @broken_decora 的装饰方法...

回答 1 投票 0

如何在 NestJS/Swagger 中禁用特定控制器方法的安全性?

我正在使用 NestJS 和 Swagger 模块来生成等效的 API 规范。 有没有办法禁用特定控制器方法的安全性,同时将控制器类标记为需要

回答 3 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.