基础例子

class Dept
{
private string name;
private Emp emp;


public string getName()
{
return this.name;
}


public void setName(string name)
{
this.name = name;
}


public Emp getEmp()
{
return this.emp;
}


public void setEmp(Emp emp)
{
this.emp = emp;
}


}


class Emp
{
private string name;
private string six;
private double tel;
private Auth auth;


public string getName()
{
return this.name;
}


public void setName(string name)
{
this.name = name;
}


public string getsix()
{
return this.six;
}
public void setSix(string six)
{
this.six = six;
}



public void setTel(double tel)
{
this.tel = tel;
}
public double getTel()
{
return this.tel;
}


public void setAuth(Auth auth)
{
this.auth = auth;
}


public Auth getAuth()
{
return this.auth;
}



}


class Auth
{
private int x;
private int y;


public void setX(int x)
{
this.x = x;
}


public int getX()
{
return this.x;
}



public void setY(int y)
{
this.y = y;
}


public int getY()
{
return this.y;
}
}


class Program
{



static void Main(string[] args)
{
//哪个部门里的哪个人有哪些权限


Auth auth1 = new Auth();


auth1.setX(1);


Auth auth2 = new Auth();
auth1.setX(1);
auth2.setY(2);


Emp zhangsan = new Emp();
zhangsan.setName("zhangsan");
zhangsan.setSix("nan");
zhangsan.setTel(21321315);
zhangsan.setAuth(auth1);


Dept it = new Dept();
it.setName("it");
it.setEmp(zhangsan);
string dept = it.getName();
Console.WriteLine("部门:" + it.getName() + "员工:" + it.getEmp().getName() + "权限" + it.getEmp().getAuth().getX());



Console.WriteLine("hello word");
Console.ReadLine();
}

进阶例子

namespace sqlgx
{ class Dept
{
private int deptid;
private String deptname;
private ArraySegment<User> userarray; public void setdeptid(int deptid)
{
this.deptid = deptid;
} public int getdeptid()
{
return this.deptid;
} public void setdeptname(string deptname)
{
this.deptname = deptname;
} public string getdeptname()
{
return this.deptname;
} } class User
{
private int userid;
private string username;
private int password;
private ArraySegment<Auth> autharray;
private ArraySegment<Manue1> manue1array; public void setuserid(int userid)
{
this.userid = userid;
} public int getuserid()
{
return this.userid;
} public void setusername(string username)
{
this.username = username;
} public string getusername()
{
return this.username;
} public void setpassword(int password)
{
this.password = password;
} public int getpassword()
{
return this.password;
} } class Auth
{
private int authid;
private int authadd;
private int authdel;
private int authupdate; public void setauthid(int authid)
{
this.authid = authid;
} public int getauthid()
{
return this.authid;
} public void setauthadd(int authadd)
{
this.authadd = authadd;
} public int getauthadd()
{
return this.authadd;
} public void setauthdel(int authdel)
{
this.authdel = authdel;
} public int getauthdel()
{
return this.authdel;
} public void setauthupdate(int authupdate)
{
this.authupdate = authupdate;
} public int getauthupdate()
{
return this.authupdate;
} } class Manue1
{
private int manue1id;
private string manue1name;
private ArraySegment<Manue2> manue2array; public void setmanue1id(int manue1id)
{
this.manue1id = manue1id;
} public int getmanue1id()
{
return this.manue1id;
} public void setmanue1name(string manue1name)
{
this.manue1name = manue1name;
} public string getmanue1name()
{
return this.manue1name;
} } class Manue2
{
private int manue2id;
private string manue2name; public void setmanue2id(int manue2id)
{
this.manue2id = manue2id;
} public int getmanue2id()
{
return this.manue2id;
} public void setmanue2name(string manue2name)
{
this.manue2name = manue2name;
} public string getmanue2name()
{
return this.manue2name;
} } class MainTest
{
/* static void Main(string[] args)
{
//创建it部门
//创建用户
Program p = new Program();
string sql = "SELECT *FROM dept,abc.`user` WHERE dept.`deptid`=1 AND abc.`user`.`deptid`=dept.deptid";
p.getUserData(sql); Console.WriteLine("hello world");
Console.ReadLine(); }*/
}

c#类的继承与包含的关系的更多相关文章

  1. Android Studio中查看类的继承关系

    查看类的继承关系的快捷键F4.在Android Studio经常使用快捷键这篇文章中.有写了.今天主要是讲一些关于这个快捷键出来的界面的一些配置.这块功能相对偏冷一些,可能非常多人都会用不到.可是关于 ...

  2. phpstorm查看类的继承关系

    在看一些框架源码时,有些类有很多的继承或者接口,有一款神奇的帮助很重要 选中一个类文件,右键,选择diagrams->show diagrams 即可得到类的继承关系,如上右图 使用函数 fun ...

  3. 游戏编程之Unity常用脚本类的继承关系

    前言学习Unity开发引擎的初学者会接触大量的脚本类,而这些类之间的关系往往容易被忽略.本文对Unity引擎开发中的一些常用类及其关系进行了简单的归纳总结. 博文首发地址:http://tieba.b ...

  4. [Android Studio] Android Studio中查看类的继承关系

    转载自:http://blog.csdn.net/hyr83960944/article/details/38098091 查看类的继承关系的快捷键F4,在Android Studio常用快捷键这篇文 ...

  5. Pycharm 查看一个类的继承关系图

    Pycharm 查看一个类的继承关系图 在我们开发过程中: 无论是使用的开发框架自带的类, 还是我们自定义的类都特别多; 并且类之间单继承和多继承频繁使用, 这个继承,不仅仅是一级的继承关系,包括好几 ...

  6. cc.isChildClassOf 判断两个类的继承关系

    使用 cc.isChildClassOf 来判断两个类的继承关系: var Texture = cc.Class(); var Texture2D = cc.Class({ extends: Text ...

  7. openmax component类的继承关系

    向OpenCORE里继承一个新的codec时,需要用到OpenMAX接口规范对该codec进行封装,即要定义一个用于封装的类(wrapper),实现OpenMAX规定的集中核心方法(omx core  ...

  8. UML类图(上):类、继承和实现

    面向对象设计 对于一个程序员来说,在工作的开始阶段通常都是别人把东西设计好,你来做.伴随着个人的成长,这个过程将慢慢变成自己设计一部分功能来实现,自己实现.如果要自己设计,无论是给自己看,还是给别人看 ...

  9. 【Python五篇慢慢弹(5)】类的继承案例解析,python相关知识延伸

    类的继承案例解析,python相关知识延伸 作者:白宁超 2016年10月10日22:36:57 摘要:继<快速上手学python>一文之后,笔者又将python官方文档认真学习下.官方给 ...

随机推荐

  1. The Microservices Workflow Automation Cheat Sheet

    Written by Bernd Rücker on Dec 12 2018 in the Best Practices category. Editor’s Note: This post orig ...

  2. How_Require_Extensions_Work

    Why Doing require extensions correctly is essential, because: Users should be able to install multip ...

  3. C#_从DataTable中检索信息

    C#_从DataTable中检索信息 存在于内存中的虚拟表DataTable,绑定在数据显示控件后,如果想在再检索其中某些信息,可以利用DataTable.Select方法进行检索,避免了重复的读取数 ...

  4. Git中清除远程仓库HTTPS认证信息的方法

    Git远程仓库同步时用户认证有两种方式:HTTPS.SSH,对应的Git仓库上有两个不同的链接地址. https方式使用账号和密码授权,简单易用,便于进行权限细分管理,而且防火墙一般会打开 http ...

  5. async await 的 实质 本质

    async await  的 实质 就是 用 “状态机” 来 取代 函数层层调用 . async await  的 本质 是 语法糖,  和 提高性能 什么的 没什么关系 . 为了避免理解歧义, 我把 ...

  6. 编写python扩展

    代码: #include <Python.h> static PyObject * spam_system(PyObject *self, PyObject *args) { const ...

  7. sql语句实战

    1,排名,自身连接,用count,去重用distinct 2,累加,和上面一样,自身连接,用sum 3,count函数不用group by只有一组

  8. Anaconda详细安装使用教程

    版权声明:本文为博主原创文章,欢迎大家转载,但是要注明我的文章地址. https://blog.csdn.net/program_developer/article/details/79677557 ...

  9. 页面框架加载完自动执行函数$(function(){});

    页面中有一些大的资源文件,如图片,声音等,如果一个事件绑定写在这些加载资源代码的下方,那么要等资源加载完才会绑定,这样体验不够好. 于是想不等资源加载完,只要框架加载完成就绑定事件,就可以把代码放在以 ...

  10. 开发人员行走Unix的随身四艺

    Unix系统永远只会越来越多,开发人员就没必要特意学习它们的安装.配置和管理了,就全部交给集成人员吧.     但开发人员行走于Unix之间,依然有四样东西要熟练. 一.VI     虽然Unix上的 ...