Solved

Calling a Class Library function without explicitly using the class name

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

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

746 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

12 Experts available now in Live!

Get 1:1 Help Now