Solved

Calling a Class Library function without explicitly using the class name

Posted on 2014-01-14
1
256 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…
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…
A short film showing how OnPage and Connectwise integration works.

914 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now