Solved

Calling a Class Library function without explicitly using the class name

Posted on 2014-01-14
1
262 Views
Last Modified: 2014-01-14
Suppose we have a namespace "MyFavoriteLibrary" and within that there is a class called "MyLib and within MyLib is a function called "MyFunct."

I believe that I can call that function by MyFavoriteLibrary::MyLib::MyFunct()

I believe that I can also use

using namespace MyFavoriteLibrary;

MyLib::MyFunct();

Is there a way to set-up the library or application to simply call

MyFunct();
0
Comment
Question by:rickhill11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 39779850
Hi rickhill11,

IMO the only possibility is to declare a macro like i.e.:

  #define MyFunct MyFavoriteLibrary::MyLib::MyFunct

I hope you noticed this can only work for static member functions.

Hope this helps,

best regards,

ZOPPO
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question