| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1394 人关注过本帖
标题:怎么不成功呀
只看楼主 加入收藏
nyzfl
Rank: 1
等 级:新手上路
帖 子:278
专家分:0
注 册:2005-3-21
收藏
 问题点数:0 回复次数:10 
怎么不成功呀
using System;
class Test
{
 public static void Main()
 {
  
  float[] vals={(float)2.0,(float)3.0};
  Quad q=new Quad(Val[0],Val[1]);
  Triangle t=new Triangle(Val[0],Val[1]);
  Console.WriteLine("Quad area is {0}",q.GetArea());
  Console.WriteLine("Triangle area is {0}",t.GetArea());
 }
}
public abstract class Shape
{
 protected float width;
 protected float height;
 public Shape(float w,float h)
 {
  width=w;
  height=h;
 }
 public abstract float GetArea();
}
public class Quad:Shape
{
 public Quad(float w,float h):base(w,h)
 {
 }
 public override float GetArea()
 {
  return width*height;
 }
}
public class Triangle:Quad
{
 public Triangle(float w,float h):base(w,h)
 {
 }
 public override float GetArea()
 {
  return 0.5F*width*height;
 }
}
搜索更多相关主题的帖子: Triangle public float Quad abstract 
2005-04-07 11:59
yichen
Rank: 1
等 级:新手上路
帖 子:303
专家分:0
注 册:2005-3-9
收藏
得分:0 
float[] vals={(float)2.0,(float)3.0};
  Quad q=new Quad(Val[0],Val[1]);
  Triangle t=new Triangle(Val[0],Val[1]);
上面的Val 应该改为vals吧
我也初学者!

衣带渐宽终不悔, 为伊消得人憔悴。 纸上得来终觉浅, 绝知此事要躬行。
2005-04-07 12:06
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
同意楼上的。
运行一次就知道了啊。

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-07 12:35
nyzfl
Rank: 1
等 级:新手上路
帖 子:278
专家分:0
注 册:2005-3-21
收藏
得分:0 
不能运行

My-Blog地址:http://fenglin.
2005-04-07 16:32
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
我改了运行了就出了结果了。

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-07 16:35
nyzfl
Rank: 1
等 级:新手上路
帖 子:278
专家分:0
注 册:2005-3-21
收藏
得分:0 
不是吧

My-Blog地址:http://fenglin.
2005-04-07 16:38
yushengou
Rank: 1
等 级:新手上路
帖 子:401
专家分:0
注 册:2005-3-30
收藏
得分:0 
真的。你用什么编译器啊。
我用的是VS

我是初学者,希望大家能多多帮助我 /bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://bbs./bbs/showimg.asp?BoardID=34&filename=2005-4/200542294030151.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2005-04-07 16:43
nyzfl
Rank: 1
等 级:新手上路
帖 子:278
专家分:0
注 册:2005-3-21
收藏
得分:0 
visual c#.net

My-Blog地址:http://fenglin.
2005-04-07 16:55
幻风幻云
Rank: 1
等 级:新手上路
帖 子:762
专家分:0
注 册:2005-1-14
收藏
得分:0 
改了以后还有问题吗?
把错误贴上来看看

2005-04-07 16:57
nyzfl
Rank: 1
等 级:新手上路
帖 子:278
专家分:0
注 册:2005-3-21
收藏
得分:0 
名称“val”在类或命名空间“test”不存在

My-Blog地址:http://fenglin.
2005-04-07 16:59
快速回复:怎么不成功呀
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015762 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved