C++ class实现孩子表示法

Posted Wecccccccc

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++ class实现孩子表示法相关的知识,希望对你有一定的参考价值。

在这里插入图片描述
代码如下:

#include <iostream>
using namespace std;
typedef char ElemType;
const int MAXSIZE = 100;

class link
{
	friend class Node;
private:
	int child;
	link *next;
};

class Node
{
	friend class Tree;
private:
	ElemType data;
	link *first;
};

class Tree
{
private:
	int n;
	Node elem[MAXSIZE];
};

以上是关于C++ class实现孩子表示法的主要内容,如果未能解决你的问题,请参考以下文章