当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 最近要写一个程序,想用一条sql语句解决下面的问题,望各位老大指教! 程序通过已知m_userid查询数据库构造一个"在线用户"xml语句 如下<f userid="int"/好友id/ alias="string"/好友昵称/ online="int"/好友是否在线0为否,1为是/ /> 现在有3......
    摘要: 凌晨查6级成绩,祝我好运啊大家!!! ......


简单的重载问题

我想问一下,在c#中关于++运算符得重载,我只见到过++的前缀版本,不知道它的后缀版本是如何实现的.还请大虾指教阿。  
  using   System;  
  class   Point  
  {  
  public   int   x;  
  public   int   y;  
  public   static   Point   operator   ++   (   Point   LValue   )  
  {  
  Point   newpoint   =   new   Point();  
  newpoint.x   =   RValue.x   +1;  
  newpoint.y   =RValue.y   +1;  
  return   newpoint;  
  }  
  public   static   Point   operator   ++   (   Point   LValue   )  
  {//后缀如何写啊  
  }  
   
  public   static   void   Main()  
  {  
  Point   mypoint   =   new   Point();  
  mypoint.x   =   100;  
  mypoint.y=   200;  
  Console.WriteLine(mypoint.x);  
  Console.WriteLine   (mypoint.y);  
   
  mypoint   =mypoint++;  
  Console.WriteLine   (mypoint.x);  
  Console.WriteLine   (mypoint.y);  
  }  
  }

NO.1   作者: saucer

you   only   need   one   version,   see   the   specification:  
  http://www.jaggersoft.com/csharp_standard/14.6.5.htm  
   
  "......  
  The   ++   and   --operators   also   support   postfix   notation   (§14.5.9).   2   The   result   of   x++   or   x--is   the   value   of   x   before   the   operation,   whereas   the   result   of   ++x   or   --x   is   the   value   of   x   after   the   operation.   3   In   either   case,   x   itself   has   the   same   value   after   the   operation.    
  Paragraph   6  
   
  An   operator   ++   or   operator   --implementation   can   be   invoked   using   either   postfix   or   prefix   notation.  
   
  It   is   not   possible   to   have   separate   operator   implementations   for   the   two   notations.    
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
  ...."  
   
 


 ·求助c编程--链表问题    »显示摘要«
    摘要: 各位大侠好,老弟在学习谭浩强教授的《c程序设计(第二版)》中的关于用指针处理链表一节时遇到一个非常疑惑的问题,书的285页的链表插入操作中,第二次插入的节点数据为什么会把第一次插入的节点数据冲掉呢?这样说来,插入第一个节点时所用的内存空间来源于先前删除节点的空间罗??既然冲掉了第一次插入的数据,那么输出链表数据时的无限循环又是怎么回事啊,搞得我一头雾水啊!望指点迷津!!! ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE