开发者

can a aspx page have more than one aspx.cs class to inherit?

开发者 https://www.devze.com 2023-01-28 16:38 出处:网络
i want to know, can one aspx page have t开发者_运维技巧wo or more code behind page? like if i have page collge.aspx, by default it will inherit college.aspx.cs, i want to know can\'t it inherit more t

i want to know, can one aspx page have t开发者_运维技巧wo or more code behind page? like if i have page collge.aspx, by default it will inherit college.aspx.cs, i want to know can't it inherit more then one aspx.cs. If not then why?


A class cannot inherit two different base classes. (.Net does not support multiple inheritance)

However, you can inherit a single base class which is split among multiple files using the partial keyword.


No
C# does not support multiple inheritance.


In .NET you only have single inheritance, but multiple interface implementation.

have two or more code behind page?

Well in .NET you have the principle of partial classes so you could create multiple files and spread the logic of that one class over these files. In ASP.NET the .aspx.designer.cs file does the same actually.

0

精彩评论

暂无评论...
验证码 换一张
取 消