相当于 with(来自 Pascal)到 C/C++
Pascal 语言中的 with
在 C/C++ 语言中相当于什么?
with
语句是引用记录字段或对象字段、属性和方法的简写。
示例
With (Object) do
begin
Width:=200;
Height:=300;
end;
相当于:
Object.Width=200;
Object.Height=200;
What is the equivalent of with
from Pascal language in C/C++ language?
A with
statement is a shorthand for referencing the fields of a record or the fields, properties, and methods of an object.
Example
With (Object) do
begin
Width:=200;
Height:=300;
end;
Is Equivalent with:
Object.Width=200;
Object.Height=200;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不相信 c/c++ 中有任何与该语句直接等效的内容。
如果您的目标是避免重复键入“Object”,那么我想您可以使用引用将其映射到更短的名称,例如:
但我个人只会在“Object”是复杂表达式的情况下使用它。例如:
I don't believe that there is any direct equivalent to that statement in c/c++.
If your objective is to avoid repeatedly typing "Object", then I suppose you could use a reference to map it to a shorter name, such as:
But I would personally only use this in cases where "Object" is a complex expression. E.g.: