Does C++ have “with” keyword like Pascal?

后端 未结 17 880
傲寒
傲寒 2020-12-06 05:02

with keyword in Pascal can be use to quick access the field of a record. Anybody knows if C++ has anything similar to that?

Ex: I have a pointer with m

17条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-06 05:21

    The closest you can get is method chaining:

    myObj->setX(x)
         ->setY(y)
         ->setZ(z)
    

    for setting multiple fields and using for namespaces.

提交回复
热议问题