Click here to Skip to main content
16,010,427 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
Questionstl use <list> Pin
nne-vitamin16-Dec-05 5:19
nne-vitamin16-Dec-05 5:19 
AnswerRe: stl use <list> Pin
toxcct18-Dec-05 21:14
toxcct18-Dec-05 21:14 
GeneralRe: stl use <list> Pin
nne-vitamin21-Dec-05 22:15
nne-vitamin21-Dec-05 22:15 
GeneralRe: stl use <list> Pin
toxcct21-Dec-05 22:25
toxcct21-Dec-05 22:25 
GeneralRe: stl use <list> Pin
nne-vitamin21-Dec-05 23:10
nne-vitamin21-Dec-05 23:10 
GeneralRe: stl use <list> Pin
toxcct21-Dec-05 23:13
toxcct21-Dec-05 23:13 
GeneralRe: stl use <list> Pin
nne-vitamin21-Dec-05 23:31
nne-vitamin21-Dec-05 23:31 
GeneralRe: stl use <list> Pin
toxcct21-Dec-05 23:59
toxcct21-Dec-05 23:59 
nne-vitamin wrote:
Do I have to define these methods anywhere????


yes of course !!
in general, we declare a class in a .h file, and implement it in a .cpp.
myclass.h:
<font color=blue>class</font> MyClass {
  <font color=blue>private</font>:
    <font color=blue>char</font> m_myVar1[255]; 
    <font color=blue>char</font> m_myVar2[255]; 
 
  <font color=blue>public</font>: 
    MyClass();
    ~MyClass(); 
    <font color=blue>const char</font>* getMyVar1();
    <font color=blue>const char</font>* getMyVar2();
 
    <font color=green>// these are for comparison</font>
    <font color=blue>bool operator</font> <  (<font color=blue>const</font> MyClass&);
    <font color=blue>bool operator</font> >  (<font color=blue>const</font> MyClass&);
    <font color=blue>bool operator</font> <= (<font color=blue>const</font> MyClass&);
    <font color=blue>bool operator</font> >= (<font color=blue>const</font> MyClass&);
    <font color=blue>bool operator</font> == (<font color=blue>const</font> MyClass&);
};

myclass.cpp:
MyClass::MyClass() {
    <font color=green>//initialise your class instance here...</font>
}
 
MyClass::~MyClass() {
    <font color=green>//free memory allocated on the heap here...</font>
}
 
<font color=blue>const char</font>* MyClass::getMyVar1() {
    <font color=blue>return this</font>->myVar1;
}
 
<font color=blue>const char</font>* MyClass::getMyVar2() {
    <font color=blue>return this</font>->myVar2;
}
 
<font color=blue>bool</font> MyClass::operator < (<font color=blue>const</font> MyClass& crefCl) {
    <font color=green>//do the comparison here...</font>
}
 
<font color=blue>bool</font> MyClass::operator > (<font color=blue>const</font> MyClass& crefCl) {
    <font color=green>//do the comparison here...</font>
}
 
<font color=blue>bool</font> MyClass::operator <= (<font color=blue>const</font> MyClass& crefCl) {
    <font color=green>//do the comparison here...</font>
}
 
<font color=blue>bool</font> MyClass::operator >= (<font color=blue>const</font> MyClass& crefCl) {
    <font color=green>//do the comparison here...</font>
}
 
<font color=blue>bool</font> MyClass::operator == (<font color=blue>const</font> MyClass& crefCl) {
    <font color=green>//do the comparison here...</font>
}




TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VisualCalc 3.0]

-- modified at 6:35 Thursday 22nd December, 2005
GeneralRe: stl use &amp;amp;amp;amp;amp;amp;amp;amp;lt;list&amp;amp;amp;amp;amp;amp;amp;amp;gt; Pin
nne-vitamin22-Dec-05 0:38
nne-vitamin22-Dec-05 0:38 
GeneralRe: stl use &lt;list&gt; Pin
toxcct22-Dec-05 0:47
toxcct22-Dec-05 0:47 
GeneralRe: stl use &amp;lt;list&amp;gt; Pin
nne-vitamin22-Dec-05 0:57
nne-vitamin22-Dec-05 0:57 
GeneralRe: stl use &lt;list&gt; Pin
toxcct22-Dec-05 0:59
toxcct22-Dec-05 0:59 
GeneralRe: stl use &amp;amp;amp;lt;list&amp;amp;amp;gt; Pin
nne-vitamin22-Dec-05 1:26
nne-vitamin22-Dec-05 1:26 
GeneralRe: stl use &lt;list&gt; Pin
toxcct22-Dec-05 2:11
toxcct22-Dec-05 2:11 
GeneralRe: stl use &amp;amp;amp;lt;list&amp;amp;amp;gt; Pin
nne-vitamin22-Dec-05 2:44
nne-vitamin22-Dec-05 2:44 
GeneralRe: stl use &amp;amp;amp;amp;lt;list&amp;amp;amp;amp;gt; Pin
toxcct22-Dec-05 2:51
toxcct22-Dec-05 2:51 
GeneralRe: stl use &amp;amp;amp;amp;lt;list&amp;amp;amp;amp;gt; Pin
Axter25-Dec-05 1:06
professionalAxter25-Dec-05 1:06 
QuestionRefer MSDN code, but STL's operator () has problem! Pin
simonchen.net14-Dec-05 18:30
simonchen.net14-Dec-05 18:30 
AnswerRe: Refer MSDN code, but STL's operator () has problem! Pin
toxcct15-Dec-05 0:41
toxcct15-Dec-05 0:41 
AnswerRe: Refer MSDN code, but STL's operator () has problem! Pin
SilentSilent15-Dec-05 0:46
SilentSilent15-Dec-05 0:46 
QuestionTo change the color of Button Pin
srimayank11_codeproject14-Dec-05 3:19
srimayank11_codeproject14-Dec-05 3:19 
AnswerRe: To change the color of Button Pin
Jörgen Sigvardsson14-Dec-05 9:21
Jörgen Sigvardsson14-Dec-05 9:21 
QuestionVS 2005, Boost and STLPort Pin
Rob Caldecott14-Dec-05 2:26
Rob Caldecott14-Dec-05 2:26 
AnswerRe: VS 2005, Boost and STLPort Pin
Jörgen Sigvardsson14-Dec-05 9:10
Jörgen Sigvardsson14-Dec-05 9:10 
GeneralRe: VS 2005, Boost and STLPort Pin
Rob Caldecott14-Dec-05 11:38
Rob Caldecott14-Dec-05 11:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.