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. Nested Class [modified]

Nested Class [modified]

Scheduled Pinned Locked Moved C#
4 Posts 2 Posters 1 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.
  • I Offline
    I Offline
    i gr8
    wrote on last edited by
    #1

    Is it possible to have a nested class like this

    class a : b
    {
    class a
    {
    }

    }

    I am curently working in a Maintenance project, i have decompiled some dll to know the coding nature inside it, there i saw similar kind of nested class. any of you have idea on this.

    modified on Wednesday, February 10, 2010 7:37 AM

    OriginalGriffO 1 Reply Last reply
    0
    • I i gr8

      Is it possible to have a nested class like this

      class a : b
      {
      class a
      {
      }

      }

      I am curently working in a Maintenance project, i have decompiled some dll to know the coding nature inside it, there i saw similar kind of nested class. any of you have idea on this.

      modified on Wednesday, February 10, 2010 7:37 AM

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      No. (As you would have found out if you had tried it.) You can't have the same name fro a class and a class member (which the nested class is assumed to be). The compiler will complain. You can have:

      class a : b
      {
      class c
      {
      }

      }

      If Barbie is so popular, why do you have to buy her friends? Eagles may soar, but weasels don't get sucked into jet engines. If at first you don't succeed, destroy all evidence that you tried.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      I 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        No. (As you would have found out if you had tried it.) You can't have the same name fro a class and a class member (which the nested class is assumed to be). The compiler will complain. You can have:

        class a : b
        {
        class c
        {
        }

        }

        If Barbie is so popular, why do you have to buy her friends? Eagles may soar, but weasels don't get sucked into jet engines. If at first you don't succeed, destroy all evidence that you tried.

        I Offline
        I Offline
        i gr8
        wrote on last edited by
        #3

        yes i do know that Nested class name cannot be as same as its holding class, but when i tried to Decompile a DLL it show similar kind of code inside that, Any idea on that

        OriginalGriffO 1 Reply Last reply
        0
        • I i gr8

          yes i do know that Nested class name cannot be as same as its holding class, but when i tried to Decompile a DLL it show similar kind of code inside that, Any idea on that

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          A nested class can contain anything, methods, fields, properties, events, etc. I think I do not understand what you are having a problem with. Can you try explaining what you are trying to do or having a problem with in more detail, please?

          If Barbie is so popular, why do you have to buy her friends? Eagles may soar, but weasels don't get sucked into jet engines. If at first you don't succeed, destroy all evidence that you tried.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          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