Go Back  Xtreme Visual Basic Talk > Other Languages > Miscellaneous Languages > Intellisense


Reply
 
Thread Tools Display Modes
  #1  
Old 10-16-2002, 05:37 PM
usetheforce2's Avatar
usetheforce2 usetheforce2 is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jul 2000
Location: Toronto, Ontario, Canada
Posts: 1,410
Default Intellisense


could someone try this class to see if the intellisense works... for some reason its not working correctly ( i don't think ) as far as Microsoft c++ is concerned.

when a new object in defined, and when i try to access the methods for that class using the dot in an app, i'm not getting any intellisense on any methods.


Code:
#include <iostream.h>


template < class T > class number
{
  private:
  T theNumber;
  public:
  number(T n);
  void displayNumber(void);
};

template < class T > number<T>::number(T n)
{
  theNumber = n;
}

template < class T > void number<T>::displayNumber(void)
{
  cout<<"Number #";
  cout<<theNumber<<endl;
}

int main()
{
  number<double> j(10);
  
  return 0;

}
__________________
winsock siteHERE||EliteVBHERE||C++ & VB Markup UtilityHERE
Reply With Quote
  #2  
Old 10-16-2002, 05:56 PM
noRulez's Avatar
noRulez noRulez is offline
Contributor
 
Join Date: Aug 2002
Location: Kansas
Posts: 502
Default

yup, it works fine with
Code:
number blah;
blah.theNumber
maybe you could try restarting your ide or computer or both?


edit: I'm sorry, I was jumping the gun there. It does pull up the intellisense menu if you declare an object like I did up there, but it doesn't offer anything but theNumber. hmmm, let me look at it here.
__________________
"As far as the laws of mathematics refer to reality, they are not certain; as far as they are certain, they do not refer to reality."--Albert Einstein
Reply With Quote
  #3  
Old 10-16-2002, 06:04 PM
usetheforce2's Avatar
usetheforce2 usetheforce2 is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jul 2000
Location: Toronto, Ontario, Canada
Posts: 1,410
Default

are you using Microsoft c++?

the wierd thing is that the methods still work ok (if you manually type them in) but, it would be nice to have the intellisense to come up.
__________________
winsock siteHERE||EliteVBHERE||C++ & VB Markup UtilityHERE
Reply With Quote
  #4  
Old 10-16-2002, 06:08 PM
noRulez's Avatar
noRulez noRulez is offline
Contributor
 
Join Date: Aug 2002
Location: Kansas
Posts: 502
Default

I see exactly what you're saying, and I've been sitting here trying to figure out why for about 5 minutes...weird. And yeah, it works fine...hmmm

yeah, I'm using visual c++. the only thing that shows up in intellisense is the private variable...
__________________
"As far as the laws of mathematics refer to reality, they are not certain; as far as they are certain, they do not refer to reality."--Albert Einstein
Reply With Quote
  #5  
Old 10-16-2002, 06:12 PM
noRulez's Avatar
noRulez noRulez is offline
Contributor
 
Join Date: Aug 2002
Location: Kansas
Posts: 502
Default

here's something odd. If you change void to int or something, it'll show up. Change it for the function displayNumber...
__________________
"As far as the laws of mathematics refer to reality, they are not certain; as far as they are certain, they do not refer to reality."--Albert Einstein
Reply With Quote
  #6  
Old 10-16-2002, 06:16 PM
usetheforce2's Avatar
usetheforce2 usetheforce2 is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jul 2000
Location: Toronto, Ontario, Canada
Posts: 1,410
Default

WTH? no doubt that does work?? i'm so confused!

Edit: Now when you change the function definition from void to int, it doesn't work again


Edit: now if i automatically inline the function it works...
void displayNumber(void){cout<<"Number #"<<theNumber<<endl;}
__________________
winsock siteHERE||EliteVBHERE||C++ & VB Markup UtilityHERE

Last edited by usetheforce2; 10-16-2002 at 06:23 PM.
Reply With Quote
  #7  
Old 10-16-2002, 06:32 PM
noRulez's Avatar
noRulez noRulez is offline
Contributor
 
Join Date: Aug 2002
Location: Kansas
Posts: 502
Default

I was going to suggest trying that, although I don't really understand what is going on here. Another thing that is odd is that, usually when you type public: or private: it will automatically left align it, but it doesn't do that if you start out with the template code. Lots of weird things here.
__________________
"As far as the laws of mathematics refer to reality, they are not certain; as far as they are certain, they do not refer to reality."--Albert Einstein
Reply With Quote
  #8  
Old 10-16-2002, 06:35 PM
usetheforce2's Avatar
usetheforce2 usetheforce2 is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jul 2000
Location: Toronto, Ontario, Canada
Posts: 1,410
Default

ya, i noticed that as well (public/private left align)
__________________
winsock siteHERE||EliteVBHERE||C++ & VB Markup UtilityHERE
Reply With Quote
  #9  
Old 10-16-2002, 07:36 PM
usetheforce2's Avatar
usetheforce2 usetheforce2 is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jul 2000
Location: Toronto, Ontario, Canada
Posts: 1,410
Default

microsoft is working on a fix for that bug.... BAHHH!

read article
__________________
winsock siteHERE||EliteVBHERE||C++ & VB Markup UtilityHERE
Reply With Quote
  #10  
Old 10-16-2002, 07:43 PM
noRulez's Avatar
noRulez noRulez is offline
Contributor
 
Join Date: Aug 2002
Location: Kansas
Posts: 502
Default

hehehehee....you could do all of your member functions inline! how fun!
__________________
"As far as the laws of mathematics refer to reality, they are not certain; as far as they are certain, they do not refer to reality."--Albert Einstein
Reply With Quote
  #11  
Old 10-16-2002, 07:48 PM
usetheforce2's Avatar
usetheforce2 usetheforce2 is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jul 2000
Location: Toronto, Ontario, Canada
Posts: 1,410
Default

ya, this is what i was working on... it'll be a mess all being inlined!
Code:
#include <iostream.h>              // used only once, in showitems() with cout<<
/*  
Programmer:      Regan DeDiana
Date        October 16, 2002
Description:    collection class
implementations:  Additem    -  used to add new items to the list 
          RemoveItem  -  removes an item from the list based on the item value
          RemoveIndex -  removes an item from the list based on the ordinal (index) positon
          Count    -  returns the total amount of items in the list
          Value    -  returns a value determined by the list index
          ShowItems  -  temp method to display list of all nodes data
*/
template <class NTYPE> class col 
{
private:
  NTYPE  data;                // data that can be stored 
  long  item_count;              // contians the node count for the list
  col    *next;                // Next - represents next node in list  
  col    *tail;                // tail - represents the last node in the list 
public:
  col()  {next = NULL;data = 0;tail = NULL;}  // constructor 
  void  AddItem(NTYPE value);        // used to add new item to list
  void  ShowItems();            // (temp) show list contents
  bool  RemoveItem(NTYPE);          // remove node by item value
  bool  RemoveIndex(long);          // remove node by list position
  long  Count(){return item_count;}      // return the count of nodes in list
  NTYPE  Item(long);              // return at value from the list based 
                        // on list position
};
template <class NTYPE>
NTYPE col<NTYPE>::Item(long index)
{
  /*
    +--------------------------- process -----------------------------------+
    + o check if index value is lareger the total nodes in list        +
    +    1. if True, return null                      +
    +    2. if False, search for node                  +
    + o  traverse list until desired node is located  (located by index    +
    +    position)                            +
    + o  return value                            +
    +-----------------------------------------------------------------------+
  */
  if(index <= item_count)
  {
    
    col *item;    // used to search list
    item = this->next;
    for(long x = 0; x <index ; ++x)
    {
      item = item->next;
    }
    return item->data;
  }
  return NULL;
}
template<class NTYPE>
void col<NTYPE>::AddItem(NTYPE value)
{
  /*
    +--------------------------- process -----------------------------------+
    + o  check if new node will be first in list (if this->next is NULL)    +
    +    if first set root->next node to new node            +
    + o  check if tail node is NULL: if tail node is null we are adding the  +
    +    the first node to the list                    +
    + o  if node isn't the first node in list then modify tail:        +
    +    1. point old tail's ->next to new node              +
    +    2. set new node as tail                      +
    + o  Increment node count                        +
    +-----------------------------------------------------------------------+
  */
  // create new node and assign value
  col *n_item;
  n_item = new col;
  n_item->data = value;

  if(this->next == NULL)    // root (this) always points to first node in list
  {  
    // this only occurs when the first node is added to the list
    this->next = n_item;  // point root node to the first node in list 
    item_count = 0;      // set up our item counter
  }
  if(tail == NULL)
  {
    tail = n_item;      // if tail is NULL then this node 
  }              // represents the first node added
  else
  {
    tail->next = n_item;  // set old tail node to point to new tail
    tail = n_item;      // set new node as tail
  }
  item_count++;  
  
//  return n_item;        // return newly added node
}
template<class NTYPE>
bool col<NTYPE>::RemoveItem(NTYPE value)
{
  /*
    +--------------------------- process -----------------------------------+
    + o  traverse list until node previous of removal node is located    +
    + o  set corpse to node we will remove                  +
    + o  set previous node (traverse) of corpse to point to node after corpse+
    + o  release corpse node memory reservation                +
    +-----------------------------------------------------------------------+
  */
  col *traverse,*corpse;          // Traverse: used to location node
                      // Corpse:   node being deleted
  traverse = this;            // set traverse to beginning of list
  while(traverse->next != NULL)      // locate item in list
  {
    if(traverse->next->data == value)
    {  corpse = traverse->next;    // select node to be removed
      traverse->next = corpse->next;  // remove link to node being removed
      this->item_count--;        // decrement item_count
      delete corpse;          // release memory
      return true;          // return true since node removal succeeded
    }
    traverse = traverse->next;
  }
  // removal failed (value was not located in list
  return false;
}
template<class NTYPE>
bool col<NTYPE>::RemoveIndex(long index)
{
  /*
    +--------------------------- process -----------------------------------+
    + o  traverse list until node previous of removal node is located    +
    + o  set corpse to node we will remove                  +
    + o  set previous node (traverse) of corpse to point to node after corpse+
    + o  release corpse node memory reservation                +
    +-----------------------------------------------------------------------+
  */ 
  if(index <= item_count)
  {
    
    col *traverse,*corpse;      // Traverse: used to location node
                    // Corpse:   node being deleted
    traverse = this;        // set traverse to beginning of list

    // move to correct location in list (index position)
    for(long x = 0; x <index ; ++x)
    {
      traverse = traverse->next;
    }

    corpse = traverse->next;    // select node to be removed
    traverse->next = corpse->next;  // break link so previous node of corpse points
                    //    to node after corpse
    delete corpse;          // release memory
    this->item_count--;        // decrement item_count
    return true;
  }
  return false;
  
}
template<class NTYPE>
void col<NTYPE>::ShowItems()
{
    // This was only added for testing purposes!!!!
    // If items have been added to list, traverse the list until
    // the last item has been encountered (next == NULL)
    int x = 0;
    col *traverse;
    traverse = this->next;
    while(traverse->next != NULL)
    {
      cout<<"Index ("<<x<<") = "<<traverse->data<<endl;
      traverse = traverse->next;
      x++;
    }
    cout<<"Index ("<<x<<") = "<<traverse->data<<endl;
    
}
oh well,
__________________
winsock siteHERE||EliteVBHERE||C++ & VB Markup UtilityHERE
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->