多态性抽象类问题找不出错误谁能帮忙看一下

#include
using namespace std;
class Shape()
{public:
virtual int Area() const=0;
};
class Rectangle: public Shape{
protected:
int length,width;
public:
Rectangle(int l=0,int w=0)
{
length=l;
width=w;
}
virtual int Area()const
{
return length*width;
}
};
int main()
{ Shape *p;
Rectangle r(3,5);
p=&r;
cout<Area()<<endl;
return 0;
}

2个回答

把子类的virtual去掉,否则就覆盖了

 class Shape()

后面的一对括号不要。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Java 的多态性、抽象类与接口
Java的多态性就是体现在‘向上转型(父类指向子类的引用)’、‘继承’、‘重写’ 三个操作上,利用多态可以使得程序具有良好的扩展性,并可以对所有类对象进行通用处理。下面我们看具体实例: 1、我先定义了一个动物类: //定义了动物类,动物可以做一些事 public abstract class Animal { public void doSomething(){ ...
Java 抽象类、接口、多态性
父类变量引用子类对象 我们知道C++中用父类的指针和引用指向子类对象,从而实现多态,但是Java中没有指针,引用也和C++不同。 Java中的父类变量引用子类对象格式:Base b = new Derived(参数表) 例如:Shape C1 = new Circle(5); 抽象类和抽象函数 抽象类的定义方法是在class前加关键字abstract,抽象函数是在返回值前加关键字abstra...
C++多态性、虚函数、抽象类
一、多态 C++ 多态意味着调用成员函数时,会根据调用函数的对象的类型来执行不同的函数。 1、多态:向不同的对象发送同一个消息,不同的对象在接收时会产生不同的行为。 C++中,多态性表现形式之一,具有不同功能的函数可以用同一个函数名,即函数的重载 2、多态性,从系统实现上分为静态多态性和动态多态性 (1)静态多态性:在程序编译时系统就能决定调用的是哪个函数。如函数的重载和运算符的重载。 ...
谁能看一下这个错误?
Microsoft VBScript 编译器错误 错误 '800a03f6' rnrn缺少 'End' rnrn/iisHelp/common/500-100.asp,行242 rnrnADODB.Field 错误 '800a0bcd' rnrnBOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。 rnrn/epoch/admin/ModifyNews1.asp,行19 rn
分析器错误!!!谁能看一下!
我单独运行该程序没有错误,但将他加到另一个项目中就出现了下面的报错信息:rnrnrn分析器错误 rn说明: 在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。 rnrn分析器错误信息: 查找 标记时遇到意外的文件结尾。rnrn源错误: rnrnrn行 52: rn行 53: rn行 54: 请确认您输入的数据: rn行 55: rn行 56: rn rnrn源文件: C:\Inetpub\wwwroot\WebApplication1111111111\注册.aspx 行: 54 rnrnrn--------------------------------------------------------------------------------rn版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573
c++程序设计 多态性与抽象类
1. 进一步多态性的基本概念 2. 学会利用虚函数实现多态性 3. 学会在设计中利用纯虚函数构造抽象基类
SQL语句,找不出错误,帮忙……
[img=https://img-bbs.csdn.net/upload/201410/29/1414567736_990686.jpg][/img]
有谁能帮忙看一下~~~
<%@ page import="java.sql.*"%>rn<%rntryrnrnClass.forName("sun.jdbc.odbc.JdbcOdbcDriver");rnString dataurl="jdbc:odbc:web";rnConnection con=DriverManager.getConnection(dataurl);rnout.println("con"+con);rnout.println(" ");rnout.println("dataurl="+dataurl);rnStatement stmt;rnString sql="select * from id";rnResultSet rs;rnrs=stmt.executeQuery(sql);rnwhile(rs.next())rn rn System.out.print("user="+rs.getString("username"));rn System.out.print("pass="+rs.getString("pass"));rn System.out.println("");rn rn rncatch(Exception e)rn rn e.printStackTrace();rn out.println(" ");rn rn%>rn这搞了一天,为什么一到数据库查询哪里就出错????????????
有谁能帮忙看一下
1.我需要做一有5个页面的属性页,每个页面都有相同的3个按钮和1个复选框,它们都实现相同的功能。rn2.为了便于维护于是我做了一个派生于CPropertyPage的父类,在这个类中动态生成这3个按钮和复选框rn(它们的ID分别为IDC_BTN1、IDC_BTN2、IDC_BTN3、IDC_CHK1),并为它们映射了消息以实现功能。rn3.然后我的5个页面又派生于这个父类,这时5个页面中就都有了相同的3个按钮和1个复选框。rn4.程序在WIN2000下运行时没问题,但WIN98下运行时有时候会出问题,不知何故。rn
谁能帮忙看一下。下拉菜单
我是最近有用到javascript的,很菜,在网上看到一段代码不知道什么意思,哪位可以帮忙看一下?rnrn//SuckerTree Horizontal Menu (Sept 14th, 06)rn//By Dynamic Drive: http://www.dynamicdrive.com/style/rnrnvar menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commasrnrnfunction buildsubmenus_horizontal()rnfor (var i=0; i
请高人看一下代码!实在找不出错误~
varrnk,i:integer;rnbeginrnk:=0;rnfor i:=0 to 100 dornk:=K+i;rnend;rnedit2.text=inttostr(k);rnend.
下拉菜单错误,帮忙找错误,实在找不出了……
[code=HTML]rnrnrn rn JavaScript+DIV+CSS实现下拉菜单rnrn rn rn rnrn rn rn rnrn rn JavaScript+DIV+CSS实现下拉菜单rn rn rn rn 菜单一rn rn rn 菜单二rn rn rn 菜单三rn rn rn 一 二 三 rnrn 一一 二二 三三 rnrn 一一一 二二二 三三三 rnrn rnrnrn[/code]rn帮忙找下错误,实在找不出……
找不出错误
访问数据库时有几句是这样的,报错说:org.apache.jasper.JasperException: [Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: 'gi' 附近有语法错误。rn但是这是从查询分析器直接复制过来的啊,应该没有语法错误啊。rn谢谢了。rnrnrnStatement Stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);rnString sql="SELECT gi.GoodsID,gi.GoodsName,gt.GoodsTypeName,gi.Price,gi.NumNow,gi.NumHigh,gi.NumLow,gi.GoodsDescr FROM GoodsInfo gi INNER JOIN GoodsType gt ON gi.GoodsTypeID=gt.GoodsTypeID WHERE gi.NumLow
找不出错误?
按照书上写了个程序,可总是有错,可对照也找不出错误。rn类模板rn#ifndef Unit2Hrn#define Unit2Hrn//---------------------------------------------------------------------------rn#include rntemplate class Arrayrn private:rn T* elements;rn size_t size;rn public:rn explicit Array(size_t arraysize);rn Array(const Array &theArray);rn ~Array();rn T& operator[](size_t index);rn const T& operator[](size_t index) const;rn Array& operator=(const Array& rhs);rn;rntemplatern Array::Array(size_t arraysize):size(arraysize)rnrn elements = new T[size];rnrnrntemplatern Array::Array(const Array& theArray)rnrn size=theArray.size;rn elements= new T[size];rn for(int i=0;i<(int)size;i++)rn rn elements[i]=theArray.elements[i];rn rnrnrntemplatern Array::~Array()rnrn delete [] elements;rnrnrntemplatern const T& Array::operator[](size_t index) constrnrn if(index<0||index>=size)rn throw std::out_of_range(index<0 ? "Negative Index" : "Index too large");rn return elements[index] ;rnrntemplatern T& Array::operator[](size_t index) rnrn if(index<0 || index >=size) [color=#FF6600]//A[/color]rn throw std::out_of_range(index<0 ? "Negative Index" : "Index too large");[color=#FF6600]//B[/color]rn return elements[index] ;rnrntemplatern Array& Array::operator=(const Array& rhs)rnrn if(&rhs==this)rn return *this;rn if(elements)rn delete [] elements;rn size=rhs.size;rn elements=new T[rhs.size];rn for(int i=0;i intd(n);rn for(int i=0;i<20;i++)rn rn intd[i]=i++;rnrn rn Label1->Caption = IntToStr(intd[19]); [color=#FF6600]//显示的数值总是不对rn[/color] rnrn出了有上面的那个错误以外,还有两个错无rn总是提示A,B出的以下错误rn A W8008 Condition is always falsern B W8008 Condition is always falsern那位帮这调试一下,看错在那里
在服务器上运行时出现错误,谁能帮忙看一下是什么问题。
Server Error in '/' Application.rnrnIndex 0 is either negative or above rows count. rnDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. rnrnException Details: System.IndexOutOfRangeException: Index 0 is either negative or above rows count.rnrnSource Error: rnAn unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. rnrnrnStack Trace: rnrn[IndexOutOfRangeException: Index 0 is either negative or above rows count.]rn System.Data.DataView.GetElement(Int32 index) +1740725rn System.Data.DataView.get_Item(Int32 recordIndex) +4rn Com.Wstd.Web.dp_sh.BindCity() in E:\new\test\Com.Wstd.Web\dp.aspx.cs:33rn Com.Wstd.Web.dp_sh.Page_Load(Object sender, EventArgs e) in E:\new\test\Com.Wstd.Web\dp.aspx.cs:23rn System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15rn System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34rn System.Web.UI.Control.OnLoad(EventArgs e) +99rn System.Web.UI.Control.LoadRecursive() +47rn System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061rn
C++多态性,虚函数,重载,抽象类
1,C++多态性,虚函数,重载,比较有意思,,,,,, 在面向对象的程序中,当不同的对象接受到相同的消息产生不同的动作,这种性质称为多态性。
实验9 多态性-纯虚函数与抽象类
1、程序功能:设计一个基类Shapes,包含成员函数display()并声明为纯虚函数。Shapes类公有派生产生矩形类Rectangle和圆类Circle,分别定义display()函数实现其主要几何元素的显示。使用抽象类Shapes类型的指针(或引用),当它指向(或引用)某个派生类的对象时,就可以通过它访问该对象的虚成员函数display()实现动态多态性。 2、程序功能:利用抽象类和纯虚函数...
帮忙看一下什么错误?>
[code=SQL]rnrnCREATE DEFINER=`root`@`localhost` PROCEDURE `pro_nogoodsother`(num int , goodsId varchar(200),memberId INT,consumerId INT,p INT, oncePoint INT,comAmout INT ,canPoints INT )rnBEGIN rn DECLARE id INT ; rn DECLARE lnumber INT ; rn DECLARE STOP INT DEFAULT 0; rn DECLARE cnt INT DEFAULT 0; rn DECLARE tempId INT DEFAULT 0; rn DECLARE maxId INT DEFAULT 0; rn DECLARE flag INT DEFAULT 0; rn DECLARE tId INT DEFAULT 0; rn DECLARE asql varchar(500);rn DECLARE cur CURSOR FOR SELECT * from newtt ;rn DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET STOP=1; rn SELECT ifnull(max(goodspointId),0) INTO maxId FROM nogoodspointother; rn SELECT loopNumber INTO lnumber FROM tbl_loop; rn rn while num=5 do rn DROP table IF EXISTS `newtt`; rn rn if tempId',tempId);rn PREPARE stml FROM @asql;rn EXECUTE stml; rn rn OPEN cur; rn FETCH cur INTO id ; rn WHILE STOP <> 1 DO rn rn //略rn rn FETCH cur INTO id; rn END WHILE; rn CLOSE cur; rn end ; rn end if ; rn rn set flag=0;rnend while ;rn END;rn[/code]rnrn执行时报 newtt 不存在,是怎么回事呢?
帮忙看一下错误。谢谢。
rn头文件定义:rn[code=C/C++]rnclass WordTablernrnpublic:rn typedef std::vector WordList; ///< A list of words (strings)rn typedef std::vector OccurrenceList; ///< A list of file positions of a wordrnrnprivate:rn std::map table;rnrnpublic:rn /// The constructor generates an empty WordTablern WordTable(void);rnrn /// Add the given WordOccurrence to the table.rn void addWord(WordOccurrence word);rnrn[/code]rnrn同名.cpp文件rnrn[code=C/C++]rn/// Add the given WordOccurrence to the table.rnvoid WordTable::addWord(WordOccurrence word)rnrn WordList::push_back(word.word);//这里提示错误rnrn //OccurrenceList::push_back(word.position);rnrn table.insert( pair(WordList, OccurrenceList );rnrn map::iterator iter;rn for (iter = table.begin(); iter != table.end(); iter++)rn rn cout << "map.first:"<< iter->first<second.<< endl;rn rnrn[/code]rnrn错误提示为rnvisual studio 2008\projects\asst2\wordtable.cpp(18) : error C2352: 'std::vector<_Ty>::push_back' : illegal call of non-static member functionrnrn请问,我应该如何该。。 为什么会错误呢?
帮忙看一下错误
#includernclassrnprivate:rn static int x;rn;rnvoid func(int a)rnx=a;rnrn那里错了,怎么改 ,解释一下,谢谢
谁能帮我看一下这个错误??
private String getXmlData(String fileName) throws Exception rn //读取文件rn StringBuffer xmlData = new StringBuffer();rn File file = new File(fileName);rnrn String st = null;rn //调用这个方法时已作判断rn //if (file.exists() && file.isFile()) rn BufferedReader br = new BufferedReader(new FileReader(file));rn while ((st = br.readLine()) != null) rn xmlData.append(st).append("\n");rn rn br.close();rn //rnrn return xmlData.toString();rnrnrn为什么我的程序经常在调用这个方法的时候core掉呢?rn下面是core文件中查到的内容rn1XMCURTHDINFO Current Thread DetailsrnNULL ----------------------rn3XMTHREADINFO "main" (TID:0x3011B9B8, sys_thread_t:0x300101A0, state:R, native ID:0x1) prio=5rn4XESTACKTRACE at java.lang.StringBuffer.append(StringBuffer.java(Compiled Code))rn4XESTACKTRACE at aaaa.getXmlData(aaaa.java(Comprniled Code))
江湖救急。。。找不出错误的错误
我的网站总是运行一段时间,就会出错。重启之后就正常了。出错的地方也不出错了。错误提示是Microsoft OLE DB Provider for ODBC Drivers 错误'80040e21'. ODBC rn驱动程序不支持需要的属性。我查看了一下出错每次出错都在同样的位置,这些出错点都是在读取同一个数据表。只要有一个页出错,所有操作这个数据表的语句都出错,不管在那个页。
帮忙看一下错误在哪里
第一次点击后,正常rnrn第二次点击后,出现异常rnrnvar x,y:double;rn i:integer;rnbeginrnif chart1.SeriesCount>0 then beginrnfor i:=0 to chart1.SeriesCount-1 dornchart1.Series[i].Free;rnend;rnrnfor i:=0 to 5 do beginrnchart1.AddSeries(tlineseries.Create(self));rnx:=0;rnwhile x<=10 dornbeginrny:=sin(x+i);rnchart1.series[i].AddXY(x,y,'',rgb(255,0,0));rnx:=x+0.05;rnend;rnchart1.series[i].Title:=inttostr(i);rnrnend;
帮忙看一下这个错误!
MsgServer.exe 中的 0x75b58f09 处未处理的异常: 0xC0000005: 读取位置 0x0010039c 时发生访问冲突rnrnrn就提示这.我怎么才能找到我的错误呢?
错误。请帮忙看一下!
在同一系统中,用同样的方法,在两处实现同样的功能。可是其中一处却有如下提示。请各位高手帮忙!这是什么意思?rn提示:Application terminated.rn Error:Null object reference at line8 in doubleclicked evevt of object dw_1 of w_dingyi_peijianbianma6.rn
帮忙看一下,JSP错误
Error: 500rnLocation: /mywork/encode/encode.jsprnInternal Servlet Error:rnrnorg.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.rnD:\jakarta-tomcat-3.3.1a\work\DEFAULT\mywork\encode\encode_1.java:54: Undefined variable, class, or package name: javarn out.print(java.net.URLENcoder.encode("欢迎 大家好"));rn ^rn1 error, 1 warningrnrn at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)rn at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)rn at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)rn at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)rn at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)rn at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)rn at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)rn at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)rn at java.lang.Thread.run(Thread.java:536)rn--------------------rnrnmywork是我的web应用目录,几个别的jsp程序都运行没问题,数据库操作的jsp程序也没问题,就这个程序有问题,报上面的错误,请高手指教错在哪里,该怎么解决 谢谢
帮忙看一下错误在那里
要实现一个多条件查询,即:在search.ascx上有1个textbox为:标题,(是数据库中表Rapport 的1 个字段)和一个DropDownList:cbCate(是数据库中表categorie的字段)为:部门,一个button:查询,帮忙看一下这个查询哪里有问题 ,出错信息是“Incorrect syntax Rapport”rn rnprivate void btnRech_Click(object sender, System.EventArgs e)rn rn rn string strcon="data source =(local);initial catalog=test;user id=sa;password=;";rn SqlConnection objConnection1=new SqlConnection(strcon);rn rn string sql ="SELECT [Rapport].CD_CATEGORIE, [Rapport].NM_TITRE AS TITRE, [Rapport].NM_MOTSCLEFS AS MOTSCLEFS,";rn sql+="[Rapport].CD_AUTEUR AS AUTEUR,Categorie.CD_CATEGORIE,Categorie.NM_CATEGORIE AS CATEGORIE";rn sql+="FROM [Rapport] INNER JOIN Categorie ON Categorie.CD_CATEGORIE=[Rapport].CD_CATEGORIE";rn //sql+="FROM Rapport,Categorie WHERE Categorie.CD_CATEGORIE=Rapport.CD_CATEGORIE";rn if (txtTitre.Text != String.Empty) sql+="AND Rapport.NM_TITRE="+txtTitre.Text;//+++++++++++++++++rnrn rn SqlDataAdapter objAdapter=new SqlDataAdapter(sql,objConnection1);rnrn DataSet dsResults=new DataSet();rn objAdapter.Fill(dsResults,"dtRapport");rn rn DataView dvUK=new DataView(dsResults.Tables["dtRapport"]);rn if (cbCate.SelectedItem.Value != "0")rn dvUK.RowFilter="Categorie.CD_CATEGORIE="+cbCate.SelectedItem.Value.ToString();rn rn grdResults.DataSource=dvUK;rn grdResults.DataBind();rnrn
错误 请帮忙看一下
#ifndef ARRAY_Hrn#define ARRAY_Hrnrn#include rnrnrntemplate class Array;rntemplate ostream&rn operator<<( ostream &, Array & );rnrntemplate rnclass Array rnpublic:rn explicit Array( int sz = DefaultArraySize )rn init( 0, sz ); rnrn Array( const elemType *ar, int sz )rn init( ar, sz ); rnrn Array( const Array &iA )rn init( iA._ia, iA._size ); rnrn virtual ~Array() delete[] _ia; rnrn Array& operator=( const Array & );rn int size() const return _size; rnrn virtual elemType& operator[]( int ix ) return _ia[ix]; rn virtual elemType operator[]( int ix ) const return _ia[ix]; rnrn elemType at( int ix ) const return _ia[ ix ]; rnrn virtual ostream &print( ostream& = cout ) const;rn virtual void grow();rn virtual void sort( int,int );rn virtual int find( const elemType& );rnrn virtual elemType min();rn virtual elemType max();rnrnprotected:rn void init( const elemType*, int );rn void swap( int, int );rnrn //static const int DefaultArraySize = 12;rn static const int DefaultArraySize;rnrn int _size;rn elemType *_ia;rn;rnrn#endifrn#ifndef ARRAY_Crn#define ARRAY_Crnrn#include rn#include "Array.h"rnrntemplate rnconst int Array::DefaultArraySize = 12;rnrntemplate rn void Array::init( const elemType *array, int sz )rnrn if ( ! array ) _size = 0; _ia = 0; rn if ( sz < 1 ) sz = 1;rnrn _size = sz;rn _ia = new elemType[ _size ];rnrn if ( ! array ) return;rnrn for ( int ix = 0; ix < _size; ++ix )rn _ia[ ix ] = array[ ix ];rnrnrntemplate Array&rn Array::operator=( const Array &iA )rnrn if ( this == &iA )rn return *this;rnrn delete[] _ia;rn init( iA._ia, iA._size );rn return *this;rnrnrntemplate ostream&rn operator<<( ostream &os, Array &ar )rnrn return ar.print( os );rnrnrntemplate rn ostream& Array::print( ostream &os ) constrnrn const int lineLength = 12;rn os << "( " << _size << " )< ";rnrn for ( int ix = 0; ix < _size; ++ix )rn rn if ( ix % lineLength == 0 && ix )rn os << "\n\t";rnrn os << _ia[ ix ];rn // don't generate comma for last item on linern // nor for the last element of the arrayrn if ( ix % lineLength != lineLength-1 && ix != _size-1 )rn os << ", ";rn rnrn os << " >\n";rn return os;rnrnrntemplate rn void Array::grow()rn rn elemType *oldia = _ia;rn int oldSize = _size;rnrn _size = oldSize + oldSize/2 + 1;rn _ia = new elemType[_size];rnrn int ix;rn for ( ix = 0; ix < oldSize; ++ix)rn _ia[ix] = oldia[ix];rnrn for ( ; ix < _size; ++ix )rn _ia[ix] = elemType();rnrn delete[] oldia;rnrnrntemplate rn elemType Array::min( )rnrn assert( _ia != 0 );rn elemType min_val = _ia[0];rnrn for ( int ix = 1; ix < _size; ++ix )rn if ( _ia[ix] < min_val )rn min_val = _ia[ix];rnrn return min_val;rnrnrntemplate rn elemType Array::max()rnrn assert( _ia != 0 );rn elemType max_val = _ia[0];rnrn for ( int ix = 1; ix < _size; ++ix )rn if ( max_val < _ia[ix] ) rn max_val = _ia[ix];rnrn return max_val;rnrnrntemplate rn int Array::find( const elemType &val )rn rn for ( int ix = 0; ix < _size; ++ix )rn if ( val == _ia[ix] ) rn return ix;rnrn return -1;rnrnrntemplate rn void Array::swap( int i, int j )rnrn elemType tmp = _ia[i];rn _ia[i] = _ia[j];rn _ia[j] = tmp;rnrnrntemplate rn void Array::sort( int low, int high )rn rn if ( low >= high ) return;rn int lo = low;rn int hi = high + 1;rn elemType elem = _ia[low];rnrn for ( ;; ) rn while ( _ia[++lo] < elem ) ;rn while ( _ia[--hi] > elem ) ;rn if ( lo < hi )rn swap( lo,hi );rn else break;rn rnrn swap( low, hi );rn sort( low, hi-1 );rn sort( hi+1, high );rnrnrn#endifrnrn
帮忙看一下这个错误
"***.jsp": Error #: 300 : class Servlet1 not found in interface javax.servlet.Servlet at line 10rnrnrn环境是jbuilder+weblogic
虚函数,虚析构函数,纯虚函数,多态性,抽象类。
1、虚函数:虚函数可以实现函数的覆盖,使得派生类中的函数得以实现,提高了程序的可扩充性,另外,基类是虚函数,派生类同名函数也会变成虚函数。指向基类的指针在指  向派生类对象时可以调用派生类。 2、虚析构函数:基类的析构函数时虚析构函数时,派生类的析构函数也自动成为虚析构函数,函数名不同也没关系,采用虚析构函数后,系统就会先调用派生类的析构函数再调用基类的析构函数,而不是直接调用基类的析构函数了。
帮忙看一下错误怎么改
我没有按书上的原意写的,还是重载了输出,可提示的错误我不知道怎么改。rnrnrnrn#includernclass Student1rnrnpublic:rn void get_value()rn rn cin>>num>>name>>sex;rn rn friend ostream& operator<<(ostream &out,Student1 &stud)rn rn out<<"number:\n"<>age>>addr;rn cout<
帮忙看一下错误之处
[code=C/C++][/code]#include"stdio.h"rn#define MAXSIZE 1000rnstruct CurStaternrn int s[9][9];rn int rule;rnsolution[MAXSIZE];rnint deep=0;rnint destination[9][9]=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,rn 18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,rn 36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,rn 54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,rn 72,73,74,75,76,77,78,79,80;rnint IsDestination(int t) //判断是否是目标状态 ,目标状态,返回1,否则0 rnrn int flag,i,j;rn flag=0;rn for(i=0;i<9;i++)rn for(j=0;j<9;j++)rn if(solution[t].s[i][j]!=destination[i][j])rn flag=1;rn if(flag) return 0;rn else return 1; rnrnint IsHad(int t) //判断是否是原来经过的状态 ,经过,返回 0,否则1 rnrn int i,j,k,flag=0;rn for(i=0;i=MAXSIZE)rn printf("空间已满,未找到路径");rn if(rule>3)rn rn t--;rn solution[t].rule++;rn deep--;rn rn else rn rn if(!IsHad)rn rn t--;rn solution[t].rule++rn deep--;rn rn elsern if(!ISBeyond)rn rn Turn(t);rn deep++;rn t++;rn rn elsern solution[t].rule++;rn rn rn for(i=0;i
帮忙看一下,错误在哪?
这是从论坛上拷过去的,我不知怎么动的,现在总出现错误,指向对的是VB的说出现运行期错误,不支持该对象与属性rn<%@LANGUAGE="VBSCRIPT" CODEPAGE="CP_ACP"%>rnrnrn rn rn rn rnrnrn 查询系统rn 查询系统rn rn rnrnrn rnrnrn 系统管理rnrn rn 修改密码 rn重新登录 rnrnrnrn
谁能帮忙看一下小型服务器程序?
我最近写一个iocp+ado sql的服务程序,运行一段时间后总报错,从现象看应该是内存越界。调试了两个星期了,望大侠帮忙。不胜感激!rn代码:http://download.csdn.net/source/1981106
谁能帮忙看一下!~高手请进!~
rn各位高手请帮忙看一下上段代码有不有什么错误!~rn谢谢!~
谁能帮忙?看一下这段程序的问题
Private Sub btnCal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCal.Clickrn Even = CLng(txtEven.Text)rn Prime(0) = 3rn Prime(1) = 5rnrn J = 2rnrn For I = 6 To Even - 1rnrn For K = 2 To Int(System.Math.Sqrt(I))rnrn If I Mod K = 0 Thenrn NotPrime = Truern Exit Forrn End Ifrnrn Nextrnrn If NotPrime = False Thenrn ReDim Prime(J)rn Prime(J) = Irn J = J + 1rn End Ifrnrn Nextrnrn For I = Prime(LBound(Prime)) To Prime(UBound(Prime))rn For J = Prime(LBound(Prime)) To Prime(UBound(Prime))rn If I + J = Even Thenrn lblResult.Text = I & "+" & J & "=" & Evenrn End Ifrn Nextrn Nextrnrn End Subrn上述程序用来验证歌德巴赫猜想,前面是求小于偶数 Even 的所有素数集合,存于 Prime 中。但运行结果不正确,请大师帮忙。
编译时出错,我找不出错误,请帮忙!
[code=C/C++]#include rnint main(void)rnrn int a[3][4],i,j,max,maxj,k,flag1,flag2;rn for(i = 0; i < 3; i++)rn rn printf("请输入第%d行:\n",i);rn for(j = 0; j < 4; j++)rn rn scanf("%d",&a[i][j]);rn rn rn for(i = 0; i < 3; i++)rn rn for(j = 0; j < 4; j++)rn rn printf("%5d",a[i][j]);rn rn printf("\n");rn rn flag2 = 0; rn for(i = 0; i < 3; i++)rn rn max = a[i][0];rn for(j = 1; j < 4; j++)rn rn if(max < a[i][j])rn rn max = a[i][j];rn maxj = j;rn rn rn for(k = 0,flag1 = 1; k < 3 && flag1; k++)rn rn if(max > a[k][maxj])rn rn flag1 = 0;rn rn rn if(flag1)rn rn printf("第%d行%d列的元素值:%d为鞍点",i,maxj,max);rn flag2 = 1;rn rn rn if(!flag2)rn rn printf("3*4矩阵中无鞍点");rn rnrn return 0;rn[/code]
错误实在找不出,请帮忙谢谢
#ifndef SALESP_Hrn#define SALESP_Hrnrnclass SalesPersonrnpublic:rn SalesPerson();rn void getSalesFromUser();rn void setSales( int, double );rn void printAnnualSales();rnrnprivate:rn double totalAnnualSales();rn double sales[ 12 ];rn;rnrn#endifrn\\这是我定义的类存为salesp.hrnrn#include rn#include rnrnusing namespace std;rnrn#include "salesp.h"rnrnSalesPerson::SalesPerson()rnrn for ( int i = 0; i < 12; i++ )rn sales[ i ] = 0.0;rnrnrnrnvoid SalesPerson::getSalesFromUser()rnrn double salesFigure;rnrn for ( int i = 1; i <= 12; i++ )rn rn cout << "Enter sales amount for month " << i << ": ";rn cin >> salesFigure;rn setSales( i, salesFigure );rnrn rnrnrnrnvoid SalesPerson::setSales( int month, double amount )rnrn if ( month >= 1 && month <= 12 && amount > 0 )rn sales[ month - 1 ] =amount;rnrn else cout << "Invalid month or sales figure" << endl;rnrnrnrnvoid SalesPerson::printAnnualSales()rnrn cout << setprecision( 2 ) << fixedrn << "\nthe total annual sales are: $"rn << totalAnnualSales() << endl;rnrnrnrndouble SalesPerson::totalAnnualSales()rnrn double total = 0.0;rnrn for ( int i = 0; i < 12; i++ )rn total += sales[ i ];rnrn return total;rn rnrn\\成员函数的定义存为salesp.cpprn#include "salesp.h"rnrnint main()rnrn SalesPerson s;rnrn s.getSalesFromUser();rn s.printAnnualSales();rnrn return 0;rnrnrn\\主调用rn\\三个文件存在同一目录下编译主调用函数时出错rnompiling...rnfig06_11.cpprnLinking...rnfig06_11.obj : error LNK2001: unresolved external symbol "public: void __thiscall SalesPerson::printAnnualSales(void)" (?printAnnualSales@SalesPerson@@QAEXXZ)rnfig06_11.obj : error LNK2001: unresolved external symbol "public: void __thiscall SalesPerson::getSalesFromUser(void)" (?getSalesFromUser@SalesPerson@@QAEXXZ)rnfig06_11.obj : error LNK2001: unresolved external symbol "public: __thiscall SalesPerson::SalesPerson(void)" (??0SalesPerson@@QAE@XZ)rnDebug/fig06_11.exe : fatal error LNK1120: 3 unresolved externalsrnError executing link.exe.rnrnfig06_11.exe - 4 error(s), 0 warning(s)rn@.@rn
多表的问题,找不出错误,急~
本人在做一个多项选择答题的页面,设计了两个表,一个exercise_m用来放题目,选择答案,正确答案 如下所示:rn id chapter title A B C D answer rn 1 fruit which fruit do you like? banana apple pear orange AB rn 2 fruit which fruit is green? banana apple watermelon pear AC rn 3 animal which animal do you like? dog cat pig bird BC rn 4 animal which animal will attack people? dog wolf fish cat AB rn 5 sky which one is better? blue green brown black AB rn 6 fruit which one is red? apple pear tomato potato AC rn 7 animal which animal do you like? dog cat fish bird AD rn 另一个表exercise_m_temp 用来存放一个用户的答案,1表示他选择了这个答案 rn ansid ans_A ans_B ans_C ans_D rn 6 0 0 1 1 rn 2 0 1 1 0 rn 1 1 1 0 0 rn rn然后把2张表联起来(exercise_m.id=exercise_m_temp.ansid),用进行进一步操作.把题目,选项,以及他所选择的项都显示出来.但是结果只显示了一个表格rn我怀疑不是不是$result,和while语句有问题,但我有找不出错误,想把$row显示出来看看也不行rn望有人指点一二,先行谢过. :)rnrn$sql="select * from exercise_m inner join exercise_m_temp on exercise_m.id=exercise_m_temp.ansid";rn$result=mysql_query($sql);rn$i=1;rnwhile($row=mysql_fetch_row($result));rnrn print_r($row);rn?>rn rn rn rn rn rn rn rn rn rn rn rn >rn >rn >rn >rn rn rn rn rn
JSP问题,我找不出错误
Compute.htmlrnrnrnrn rn 选择要做的算法rn除法rn &nbsprn乘法rnrnrnrn被除数(被乘数)rn除数(乘数)rnrnrnrnrnrnrnrnrnrnrnrnrnCompute.jsprnrnrn<%@page contentType="text/html;charset=gb2312" language="java" %>rnrn<%@ include file="Compute.html" %>rn<% String value1=request.getParameter("value1");rn String value2=request.getParameter("value2");rn%>rn<% if("divide1".equals(request.getParameter("compute"))) %>rn rn rn rn rn<% else %>rn <%@ include file="multiply.jsp" %>rn<% %>rn rnrnrnrnDivide.jsprnrnrn<%@page contentType="text/html;charset=gb2312" language="java" %>rnrn<% rntryrn float a1 = Float.parseFloat(request.getParameter("v1"));rn float a2 = Float.parseFloat(request.getParameter("v2"));rn double d = a1/a2;rn%>rn<%=d%> rn<%rncatch(Exception e)out.println("不合法的除数与被除数" ); rn rn%>rnrnrnrnrnmultiply.jsprnrnrn<%@page contentType="text/html;charset=gb2312" language="java" %>rnrn<% rntryrn float a1 = Float.parseFloat(request.getParameter("value1"));rn float a2 = Float.parseFloat(request.getParameter("value2"));rn double m = a1*a2;rn%>rn<% out.println(a1+"*"+a2+"="+m);%>rn rn<%rncatch(Exception e)rnout.println("不合法的乘数与被乘数");rn rn rn%>rnrnrnrn
相关热词 c# 线程结束时执行 c# kb mb 图片 c# 替换第几位字符 c#项目决定成败 c# 与matlab c# xml缩进 c#传感器基础 c#操作wps c# md5使用方法 c# 引用父窗口的组件