将成员函数中的变量值传递给另一个函数? [英] Pass value of variable in a member function to another?

查看:166
本文介绍了将成员函数中的变量值传递给另一个函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我的程序完全忽略了我的第一堂课的第二个成员函数。第二个功能只是询问它是什么时间并以军事格式返回。我创建了第三个函数来避免我的第一个类的对象在main中重复第二个函数两次,但现在它完全忽略了&&的第二部分。条件。



我很确定我知道为什么,因为它被返回为零值,但也许我错了。

编辑:出于某种原因,它不允许我发布我的代码。 代码 - Pastebin.com [ ^ ]



我尝试过:



My problem is my program is completely ignoring the second member function of my first class. The 2nd function is just supposed to ask for what time it is and return it in military format. I created a third function to avoid the object for my first class in main repeating the 2nd function twice, however now it completely ignores the 2nd part of the && condition.

I am pretty sure I know why, as it is being returned as a value of zero, but perhaps I am wrong.
edit: For some reason it isn't letting me post my code. code - Pastebin.com[^]

What I have tried:

#include

推荐答案

引用:

它完全忽略了&的第二部分;&安培;条件。

it completely ignores the 2nd part of the && condition.

这是&& 的行为。

In result = func1(args) &安培;&安培; func2(moreargs); 如果func1返回 false ,则永远不会调用func2。

This is the behaviour of &&.
In result = func1(args) && func2(moreargs); if func1 returns false then func2 will never be called.


这篇关于将成员函数中的变量值传递给另一个函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆