小编nob*_*ody的帖子

在C++中返回"this"?

在Java中,您只需return this获取当前对象即可.你是如何用C++做到的?

Java的:

class MyClass {

    MyClass example() {
        return this;
    }
}
Run Code Online (Sandbox Code Playgroud)

c++ return this

15
推荐指数
2
解决办法
4万
查看次数

C++这个在构造函数中?

可能重复:
构造函数中的c ++调用构造函数

如何在c ++中做"自我"(这个)作业?

Java的:

 public Point(Point p) {
        this(p.x, p.y);
    }
Run Code Online (Sandbox Code Playgroud)

在C++中如何做到这一点?

它会是相似的this->(constructor of point that takes x, constructor of point that takes y);吗?

c++ java constructor this

0
推荐指数
1
解决办法
1253
查看次数

标签 统计

c++ ×2

this ×2

constructor ×1

java ×1

return ×1