GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Nov-2005, 08:38
jack223 jack223 is offline
New Member
 
Join Date: Nov 2005
Posts: 15
jack223 is on a distinguished road

How many member functions within Thing class?


CPP / C++ / C Code:
class Thing {

public:
     int Item;
     Thing (int Value);
     Thing (int Value1, int Value2);
     int GetValue1 () const;
     int GetValue2 () const;

private:
     int DataItem1;
     int DataItem2;
     void SetValue1 (int Value);
     void SetValue2 (int Value);
}

How many member functions does class Thing have?

-Thing (int Value)
-int GetValue1()
-int GetValue2()
-void SetValue1 (int Value)
-void SetValue2 (int Value)

-int DataItem1....this is data member...is it part of member function?

are there more member functions that I missed??
  #2  
Old 08-Nov-2005, 09:03
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 927
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: How many member functions within Thing class?


Constructors are also member functions.

Quote:
Originally Posted by jack
How many member functions does class Thing have?
Six.

Quote:
Originally Posted by jack
-int DataItem1....this is data member...is it part of member function?
No. DataItem1 is not a member function. It is a member variable.
I hope you know the difference between a function and a variable.

Quote:
Originally Posted by jack
are there more member functions that I missed??
Yes. This:
Thing (int Value1, int Value2);

Hence the total member functions are:
Quote:
-Thing (int Value)
-int GetValue1()
-int GetValue2()
-void SetValue1 (int Value)
-void SetValue2 (int Value)
-Thing (int Value1, int Value2);
and the total member variables are:
Quote:
int Item;
int DataItem1;
int DataItem2;

Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #3  
Old 08-Nov-2005, 09:26
jack223 jack223 is offline
New Member
 
Join Date: Nov 2005
Posts: 15
jack223 is on a distinguished road

Re: How many member functions within Thing class?


so in this case, constructors are: Thing (int Value), and Thing (int Vlaue1, int Value2)...is that right?
  #4  
Old 08-Nov-2005, 09:30
Paramesh's Avatar
Paramesh Paramesh is offline
Regular Member
 
Join Date: Sep 2005
Location: The Milky Way
Posts: 927
Paramesh is a jewel in the roughParamesh is a jewel in the roughParamesh is a jewel in the rough

Re: How many member functions within Thing class?


Yes.
Do you know the difference between them?
One constructor uses only one argument.
The other uses two arguments.
This is called overloading.


Paramesh.
__________________

Don't walk in front of me, I may not follow.
Don't walk behind me, I may not lead.
Just walk beside me and be my friend.
  #5  
Old 08-Nov-2005, 09:45
jack223 jack223 is offline
New Member
 
Join Date: Nov 2005
Posts: 15
jack223 is on a distinguished road

Re: How many member functions within Thing class?


Thanks Paramesh.
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 2) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] GUI programming with FLTK dsmith FLTK Forum 10 03-Oct-2005 15:41
templated object as member data in a class? jfritz C++ Forum 2 03-Aug-2005 03:33
GIMcontacts - a gim fltk fluid venture cable_guy_67 FLTK Forum 0 14-Feb-2005 14:18
Error C2146: syntax error : missing ',' before identifier 'C4' mattchew008 C++ Forum 2 19-Dec-2004 06:06

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:44.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.