作者DruPTT (那美克星快爆炸了)
看板C_Sharp
标题Re: [问题] override问题
时间Tue Nov 24 20:52:10 2009
请参考
http://0rz.tw/5bXp8
Socket class 并没有空建构子
只有以下二个建构子
Socket(SocketInformation)
Socket(AddressFamily, SocketType, ProtocolType)
所以你可以这样写
public class Class1:System.Net.Sockets.Socket
{
public Class1(System.Net.Sockets.SocketInformation s):base(s)
{
}
}
: using System;
: using System.Collections.Generic;
: using System.Net;
: using System.Net.Sockets;
: namespace classtest
: {
: class Class1 : Socket //Error:方法 'Socket' 没有任何多载使用 '0' 个引数
: {
: public override int Send(byte[] buffer) //无法覆写继承的成员
: 'System.Net.Sockets.Socket.
: Send(byte[])',因为它没有标记
: 为 virtual、abstract 或 override
: {
: Console.WriteLine("OK");
: return 0;
: }
: }
: }
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 219.70.161.162
1F:推 sosokill:感谢,现在已经OK了 11/24 21:29