Solved

Calling a Class Library function without explicitly using the class name

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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 describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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…

710 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