?
Solved

Template Class (No intellisense on functions)

Posted on 2006-05-12
6
Medium Priority
?
260 Views
Last Modified: 2010-04-01
template <class A>
class ClassAdd
{
private:
      A ClassObject; //Store a number
public:
      void SetNum(A COBJ); //Get a number
      A ResultAdd(A COBJ);//add stored plus new number
};
template <class A>
void ClassAdd<A>::SetNum(A COBJ) //Store COBJ
{
      ClassObject = COBJ;
}
template <class A>
A ClassAdd<A>::ResultAdd(A COBJ)//Add COBJ + ClassObject and return it
{
      return ClassObject + COBJ;
}
int main()
{
      ClassAdd<int> Add;
      Add.SetNum(5);
      cout << Add.ResultAdd(3);
      return 0;
}

Okay, say I have something like that.  It works fine, but when I type something like:
Add.
None of the functions appear in the dropdown.  Yet if I remove the function body, it works.

PS: The code runs fine, and I have tried deleting the intellisense files.
0
Comment
Question by:List244
6 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 1000 total points
ID: 16672847
Intellisense support in VC++ is restricted and it is possible to write code which is not displayed by Intellisence. There is no solution for this except upgrading VC++ version or using Visual Assist.
0
 
LVL 8

Expert Comment

by:mrblue
ID: 16673368
Sometimes intellisense if off when earlier in code is some error as I have noticed.
0
 
LVL 30

Assisted Solution

by:Axter
Axter earned 1000 total points
ID: 16673374
I completely agree with AlexFM.

I've been using Visual Assist for many years now, and it's well worth the cost.
You can download a trial version from the following link:
http://www.wholetomato.com/downloads/

For more info, see the main page:
http://www.wholetomato.com/index.html
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 8

Author Comment

by:List244
ID: 16673859
So my code is not bugged then?
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16673918
No, if your code is compiled, it is OK. The problem is that C++ compiler is more smart than Intellisence. Your code is OK for compiler, but Intellisence has some problems with it.
0
 
LVL 8

Author Comment

by:List244
ID: 16673937
Alright, well I have installed Visual Assist, I will go ahead and give that a try.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

809 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