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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. shortcut access to base class function/variable

shortcut access to base class function/variable

Scheduled Pinned Locked Moved C / C++ / MFC
oopquestion
3 Posts 2 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.
  • O Offline
    O Offline
    oRion
    wrote on last edited by
    #1

    if the statement "using namespace" could be used to shorten the name to access to a certain function/variable. Is there a similiar method to access to base class functions/variables in inheritance class functions , ie. to remove the front portion "base_class::" from "base_Class::base_class_func"? :confused:

    A 1 Reply Last reply
    0
    • O oRion

      if the statement "using namespace" could be used to shorten the name to access to a certain function/variable. Is there a similiar method to access to base class functions/variables in inheritance class functions , ie. to remove the front portion "base_class::" from "base_Class::base_class_func"? :confused:

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      normally you wouldnt need to explicitly qualify the base class variables and functions, unless they are static.... could you post some code?

      O 1 Reply Last reply
      0
      • A Anonymous

        normally you wouldnt need to explicitly qualify the base class variables and functions, unless they are static.... could you post some code?

        O Offline
        O Offline
        oRion
        wrote on last edited by
        #3

        You are right! I just tried to remove the front portions of it. Before class classOne { public: void functionOne() {} }; class classTwo: public classOne { public: void functionTwo() { classOne::functionOne(); } }; I have removed the classOne:: from the function, and it works perfectly now. I was having some problems implementing class initially, that's why I have kept the front portion. Thanks a million! ;)

        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