Visual Studio 2008-03-17 12:31:19 阅读194 评论0 字号:大中小
Inconsistent accessibility: parameter type 'Manning.MyPhotoAlbum.Photograph[]' is less accessible than method 'Manning.MyPhotoAlbum.PhotoAlbum.CopyTo(Manning.MyPhotoAlbum.Photograph[], int)'
环境:vs2005
问题原因:虽然类Photograph和PhotoAlbum在同一namespace中,但是PhotoAlbum是public的,而Photograph没有修饰符,即默认为internal.所以PhotoAlbum中的public方法访问internal类中的public成员受到限制.
解决方法:
(1)将Photograph类改为public的
(2)将PhotoAlbum类改为internal的
编译错误消失,为达到在外部使用的目的,采用(1)方法.
C#中的类的限制问题不清楚,有待于继续研究