Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Way to access class member

Way to access class member

Scheduled Pinned Locked Moved C#
game-devtutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Libra
    wrote on last edited by
    #1

    public can access by all class, internal can access by it's namespace, protected can access by it's inherit class. How to access a member only by special base class or a class which implement the special interface? :confused: === Game is power! ===

    L S 2 Replies Last reply
    0
    • L Libra

      public can access by all class, internal can access by it's namespace, protected can access by it's inherit class. How to access a member only by special base class or a class which implement the special interface? :confused: === Game is power! ===

      L Offline
      L Offline
      Luis Alonso Ramos
      wrote on last edited by
      #2

      Internal code can be accessed only from the same assembly, not namespace. As far as I know, there's no way to do what you want to. protected is useful if only a derived class can call the method. Otherwise make it public and trust your caller. -- LuisR


      Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

      The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005

      1 Reply Last reply
      0
      • L Libra

        public can access by all class, internal can access by it's namespace, protected can access by it's inherit class. How to access a member only by special base class or a class which implement the special interface? :confused: === Game is power! ===

        S Offline
        S Offline
        sreejith ss nair
        wrote on last edited by
        #3

        Impliment a containment or Nested class or a Has-a relation.:-D Sreejith Nair [ My Articles ]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups