another boring class question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    another boring class question

    class foo {
    func(int x);
    }

    class faa {
    foo fooObject;
    }

    would the function func(int x) be allowed to access private, public and
    protected member variables of faa?

    cheers
    dave


  • lilburne

    #2
    Re: another boring class question

    Dave wrote:[color=blue]
    >
    > would the function func(int x) be allowed to access private, public and
    > protected member variables of faa?
    >[/color]

    No.

    Comment

    • Phlip

      #3
      Re: another boring class question

      Dave wrote:
      [color=blue]
      > class foo {
      > func(int x);
      > }
      >
      > class faa {
      > foo fooObject;
      > }[/color]

      That code is ill-formed; meaning it won't compile.
      [color=blue]
      > would the function func(int x) be allowed to access private, public and
      > protected member variables of faa?[/color]

      What does your tutorial tell you, thru the index, about those keywords?

      --
      Phlip


      Comment

      • Dave

        #4
        Re: another boring class question

        [color=blue]
        > What does your tutorial tell you, thru the index, about those keywords?[/color]
        It tells me "friends" can access them, inherited can access public and
        protected, but this is neither of those.


        Comment

        • Phlip

          #5
          Re: another boring class question

          Dave wrote:
          [color=blue][color=green]
          > > What does your tutorial tell you, thru the index, about those keywords?[/color][/color]
          [color=blue]
          > It tells me "friends" can access them, inherited can access public and
          > protected, but this is neither of those.[/color]

          And what do your other tutorials say?

          --
          Phlip


          Comment

          • jeffc

            #6
            Re: another boring class question


            "Dave" <davefromalbury _REMOVE_THIS_TO _EMAIL_@hotmail .com> wrote in message
            news:3fcac02f@d news.tpgi.com.a u...[color=blue]
            >[color=green]
            > > What does your tutorial tell you, thru the index, about those keywords?[/color]
            > It tells me "friends" can access them, inherited can access public and
            > protected, but this is neither of those.[/color]

            Right. Are you confused about what "friends" are?


            Comment

            Working...