任何人都可以解释*p=*q这个C++代码的含义吗?这是一个复制构造函数的概念吗?
class A{
//any code
}
int main(){
A *p=new A();
A *q=new A();
*p=*q;
return 0;
}
Run Code Online (Sandbox Code Playgroud) 在c ++中我们最后编写main函数,在c中如果有任何正向函数调用,我们将在开头声明函数,或者我们将首先定义所有函数然后我们将编写main函数.但是在java中,即使我们在开头编写main方法然后是其他方法,如果我们从main方法中调用其他方法,那么会执行..Why?如何知道程序中定义了一些方法?
class Temp{
public static void main(String args[]){
display();
}
public static void display(){
System.out.println("HI");
}
}
Run Code Online (Sandbox Code Playgroud)