什么是局部类? [英] What is a partial class?

查看:84
本文介绍了什么是局部类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是以及如何在C#。

可以使用在Python / Perl的是同一个概念?

What is and how can it be used in C#.
Can you use the same concept in Python/Perl?

推荐答案

C#的部分类已经被这里解释,所以我会刚好盖住蟒蛇的一部分。您可以使用多重继承来优雅分发类的定义

The c# partial class has been already explained here so I'll just cover the python part. You can use multiple inheritance to elegantly distribute the definition of a class.

class A_part1:
    def m1(self):
        print "m1"

class A_part2:
    def m2(self):
        print "m2"

class A(A_part1, A_part2):
    pass

a = A()
a.m1()
a.m2()

这篇关于什么是局部类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆