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 / C++ / MFC
  4. A very basic question

A very basic question

Scheduled Pinned Locked Moved C / C++ / MFC
questionoraclesecurityjsonoop
4 Posts 4 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.
  • H Offline
    H Offline
    HakunaMatada
    wrote on last edited by
    #1

    Here is a basic question on Structures. Do Structures support inheritance and if so how different is it from Class inheritance?

    --- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

    M W H 3 Replies Last reply
    0
    • H HakunaMatada

      Here is a basic question on Structures. Do Structures support inheritance and if so how different is it from Class inheritance?

      --- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

      M Offline
      M Offline
      Matthew Faithfull
      wrote on last edited by
      #2

      Yes, structures do support inheritance in C++. If I remeber correctly the only difference now remaining between structures and classes is that structure members are public by default as opposed to protected. I generally use a struct by convention when the object I'm creating is data only, ie. it has no functions beyond possibly constructors. Occasionally I might use a struct with functions if I'm creating a type that's intended to behave like a built in type or a special translation type but that is a whole different tricky kettle of fish :)

      Nothing is exactly what it seems but everything with seems can be unpicked.

      1 Reply Last reply
      0
      • H HakunaMatada

        Here is a basic question on Structures. Do Structures support inheritance and if so how different is it from Class inheritance?

        --- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

        W Offline
        W Offline
        Waldermort
        wrote on last edited by
        #3

        Generally a struct is for data only, and yes they can be inherited. You will sometimes see structs derived from the built in windows types. It's not often you will see member functions within a struct, though sometimes the need does arrise, especialy when overiding the comparison operators. Other than that, a structs members are public by default, whereas a class's members are protected.

        1 Reply Last reply
        0
        • H HakunaMatada

          Here is a basic question on Structures. Do Structures support inheritance and if so how different is it from Class inheritance?

          --- :beer: Hakuna-Matata :beer: It means no worries for the rest of your days... It's our problem free, Philosophy :jig: "I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          Yes its possible on the C++ and C++.Net different is about access level also I think you need to see again about classes and structs so you will be see differences classes and structs.;)

          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