若若's profile芳草天涯PhotosBlogListsMore Tools Help

Blog


    October 03

    C++编程思想(2nd卷一):函数重载与默认参数

    在C++中,struct和class唯一的不同之处就在于,struct默认为public,而class默认为private。


    在使用默认参数时必须记住两条规则:
    1.只有参数列表的后部参数才是可默认的,也就是说,不可以在一个默认参数后面又跟一个非默认的参数。
    2.一旦在一个参数调用中开始使用默认参数,那么这个参数后面的所有参数都必须是默认的。
    默认参数只能放在函数声明中,通常在一个头文件中。编译器必须在使用该函数之前知道默认值。


    占位符参数:
    函数声明时,参数可以没有标识符。其目的在于以后可以修改函数定义而不需要修改所有的函数调用。

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    哈哈 ,青蛙跳井---扑通(不懂)
    Oct. 7

    Trackbacks

    The trackback URL for this entry is:
    http://kassandrarr.spaces.live.com/blog/cns!77C720CEE14EB4C5!2677.trak
    Weblogs that reference this entry
    • None