填充对象 [英] populating an object

查看:82
本文介绍了填充对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


对于下面给出的代码,填充对象objRes"是什么意思?填充对象的含义是什么?

公共OrderResponse getOrederRequest(Order objOrderReq)
{
OrderResponse objRes =新的OrderResponse();
返回objRes;

}

Hi,
for the code given below, what does it mean " populate object ''objRes'' ? " what is the meaning of populating an object ?

public OrderResponse getOrederRequest(Order objOrderReq)
{
OrderResponse objRes = new OrderResponse();
return objRes ;

}

推荐答案

在哪里说?

我建议您购买一本非常基础的书,或者,如果有的话,请阅读.如果您要上课,请去和老师谈谈.


Where does it say that ?

I suggest you buy a very basic book, or if you have one, read it. If you''re taking a class, go and talk to the teacher.


jazy_smith写道:
jazy_smith wrote:

OrderResponse objRes = new OrderResponse();

OrderResponse objRes = new OrderResponse();



这将创建一个OrderResponse,然后将其返回.现在这种方法是没有用的.请告诉我,您不是在问有关带薪工作的问题.我假设这是一堂课,这就是为什么您要问这样一个基本问题,但是我看不到一堂课如何为您提供此代码并要求您完成此任务,而我却可以看到一份工作会如何.

无论如何,填充一个对象意味着设置它的值.您现在拥有的方法很浪费时间,我想应该使用Order对象中的值来填充OrderResponse对象中的值.如果这段代码编写正确,OrderResponse对象将具有一个接受Order并自身填充的构造函数.



This creates an OrderResponse, which is then returned. This method right now is useless. Please tell me that you''re not asking a question about paid work. I assume this is a class, which is why you are asking such a basic question, however I don''t see how a class could give you this code and ask you to do this task, and I can see how a job would.

Anyhow, populating an object means setting it''s values. The method you have now is a waste of time, I assume it is supposed to fill values in the OrderResponse object, using values in the Order object. If this code was well written, the OrderResponse object would have a constructor that took an Order, and populated itself.


这篇关于填充对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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