There is a Compilation Program: inconsistent accessibility; causes and solutions

Source: Internet
Author: User

The Reasons and methods for my Google search are as follows:
Http://blog.csdn.net/SkyIsland/archive/2006/04/15/664716.aspx

Cause: one of them is that the access level of the returned parameter is lower than the access level of the function,
What should I do?
That is, when defining a method for returning parameters, if the access level of the returned parameters is lower than the access level of the method, this error will occur. From Oo, this is understandable, if the returned parameters cannot be accessed, the returned method is incorrectly defined.

When defining the return parameter method, the returned parameter access level must be greater than or equal to the method access level.

 

Protected user getuserbyid (INT userid)
{
User u = NULL;
// Some create user
Return U;
}

Private class user
{
Private int _ userid;
Public user (INT userid)
{
_ Userid = userid;
}
}

If the code above is not compiled by the compiler, the reason is that the accessibility of the return parameter is lower than that of the return parameter method.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.