c#中一些初学语句,不懂,还请高手解释.......关于类中的对象,和new的
usingsystem;namespacecsharpbook.chapter01{publicclasspoint{publicintx,y;publicpoint(i...
using system;
namespace csharpbook.chapter01
{
public class point{
public int x,y;
public point(int x,int y){
this.x=x;
this.y=y;
}
}
class pointtest{
static void Main(){
point p1= new point(0,0); //这句还请高人详解,是怎么在堆中申请,赋值,一点都不懂
point.p2=new point(10,20);
console.writeline("两个点的坐标分别为;");
console.writeline("p1:x; = " +p1.x +",y=" + p1.y); //还有p1.x是怎么回事啊,也不懂
console.writeline(“p2:x=” + p2.x+ ".y=" +p2.y);
console,readkey();
}
}
} 展开
namespace csharpbook.chapter01
{
public class point{
public int x,y;
public point(int x,int y){
this.x=x;
this.y=y;
}
}
class pointtest{
static void Main(){
point p1= new point(0,0); //这句还请高人详解,是怎么在堆中申请,赋值,一点都不懂
point.p2=new point(10,20);
console.writeline("两个点的坐标分别为;");
console.writeline("p1:x; = " +p1.x +",y=" + p1.y); //还有p1.x是怎么回事啊,也不懂
console.writeline(“p2:x=” + p2.x+ ".y=" +p2.y);
console,readkey();
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询