Click here to Skip to main content
15,882,152 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to get exe Pin
jannathali8-Dec-09 19:17
jannathali8-Dec-09 19:17 
AnswerRe: How to get exe Pin
Cedric Moonen8-Dec-09 20:28
Cedric Moonen8-Dec-09 20:28 
Questionhow does an uninstall exe delete itself? Pin
includeh108-Dec-09 19:02
includeh108-Dec-09 19:02 
AnswerRe: how does an uninstall exe delete itself? Pin
o m n i8-Dec-09 20:47
o m n i8-Dec-09 20:47 
GeneralRe: how does an uninstall exe delete itself? Pin
includeh108-Dec-09 21:36
includeh108-Dec-09 21:36 
GeneralRe: how does an uninstall exe delete itself? Pin
David Crow9-Dec-09 2:17
David Crow9-Dec-09 2:17 
AnswerRe: how does an uninstall exe delete itself? Pin
David Crow9-Dec-09 2:19
David Crow9-Dec-09 2:19 
QuestionInheritance!!! Pin
Nilesh Hamane8-Dec-09 18:58
Nilesh Hamane8-Dec-09 18:58 
Please see the code bellow.

#include <iostream>
#include <stdlib.h>

using namespace std;

class Cpolygon
{
    protected:
    int width, height;
    public:
      void setvalues (int a, int b)
      {
          width=a;
          height=b;      
} 
};   

class Crectangle:public Cpolygon
{
    public:
        int area ()
        {
            return(width*height);
        }    
};

class Ctriagle:public Cpolygon
{
    public:
        int area()
        {
            return((width*height)/2);
        }
    };
            
int main(int argc, char *argv[])
{
 
 Crectangle rect;
 Ctriagle tril;
 
 Cpolygon *Poly1 =&rect;
 Cpolygon *Poly2 =&tril;

 Poly1->setvalues(4,5);
 Poly2->setvalues(4,5);
 
 
 cout<<Poly1->area()<<endl;
 cout<<Poly2->area()<<endl;
   
  system("PAUSE");	
  return 0;
}


I have two questions.

1.
Cpolygon *Poly1 =▭
 Cpolygon *Poly2 =&tril;


What does these two lines indicate?

2. Instead of creating two objects of base class can we use only one object of base class to set the values.

i.e.
Cpolygon *Poly;


So that
Poly->setvalues(4,5);
need to call only once and create the objects of derived class and show the outputs i.e.

Crectangle *rect;
 Ctriagle *tril;

 cout<<rect->area()<<endl;
 cout<<tril->area()<<endl;


will it work? Confused | :confused:
Thanks for reading.
AnswerRe: Inheritance!!! Pin
Cedric Moonen8-Dec-09 20:26
Cedric Moonen8-Dec-09 20:26 
AnswerRe: Inheritance!!! Pin
cheetach8-Dec-09 20:28
cheetach8-Dec-09 20:28 
QuestionCombination C and OpenGL: Making a loop to draw circles [modified] Pin
Chidori-chan8-Dec-09 18:46
Chidori-chan8-Dec-09 18:46 
AnswerRe: Combination C and OpenGL: Making a loop to draw circles Pin
LunaticFringe8-Dec-09 19:43
LunaticFringe8-Dec-09 19:43 
GeneralRe: Combination C and OpenGL: Making a loop to draw circles Pin
Chidori-chan8-Dec-09 20:35
Chidori-chan8-Dec-09 20:35 
GeneralRe: Combination C and OpenGL: Making a loop to draw circles Pin
Cedric Moonen8-Dec-09 20:42
Cedric Moonen8-Dec-09 20:42 
GeneralRe: Combination C and OpenGL: Making a loop to draw circles Pin
Chidori-chan8-Dec-09 20:58
Chidori-chan8-Dec-09 20:58 
GeneralRe: Combination C and OpenGL: Making a loop to draw circles Pin
Tim Craig8-Dec-09 20:52
Tim Craig8-Dec-09 20:52 
GeneralRe: Combination C and OpenGL: Making a loop to draw circles [modified] Pin
Chidori-chan8-Dec-09 21:29
Chidori-chan8-Dec-09 21:29 
GeneralRe: Combination C and OpenGL: Making a loop to draw circles Pin
LunaticFringe9-Dec-09 3:42
LunaticFringe9-Dec-09 3:42 
GeneralRe: Combination C and OpenGL: Making a loop to draw circles Pin
Chidori-chan9-Dec-09 13:07
Chidori-chan9-Dec-09 13:07 
AnswerRe: Combination C and OpenGL: Making a loop to draw circles Pin
Cedric Moonen8-Dec-09 20:18
Cedric Moonen8-Dec-09 20:18 
QuestionWhy CDC::LineTo(pt) draw a line not include pt Pin
fitatc8-Dec-09 17:49
fitatc8-Dec-09 17:49 
AnswerRe: Why CDC::LineTo(pt) draw a line not include pt Pin
Richard MacCutchan8-Dec-09 22:06
mveRichard MacCutchan8-Dec-09 22:06 
GeneralRe: Why CDC::LineTo(pt) draw a line not include pt Pin
fitatc9-Dec-09 14:43
fitatc9-Dec-09 14:43 
GeneralRe: Why CDC::LineTo(pt) draw a line not include pt Pin
Richard MacCutchan9-Dec-09 23:18
mveRichard MacCutchan9-Dec-09 23:18 
GeneralRe: Why CDC::LineTo(pt) draw a line not include pt Pin
fitatc10-Dec-09 13:34
fitatc10-Dec-09 13:34 

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.