数据结构学习(C++)——如何在一个链表中链入不同类型的对象[3]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 happycock 的 blog

public:

       virtual void input() = 0;

       virtual void print() = 0;

       shape(){};

       virtual ~shape(){};

 

};

 

#endif

【说明】定义一个抽象基类,有两个行为,input()为输入图形参数,print()为打印图形参数。图省事,只是简单的说明问题而已。

#ifndef point_h

#define point_h

 

class point 

{

public:

       void put()

       {

              cout << "x坐标为:";

              cin >> x;

              cout << "y坐标为:";

              cin >> y;

       }

本文关键:数据结构 C++ 链表
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top