Click here to Skip to main content
15,901,373 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Media player 10 like toolbar using Win32 [modified] Pin
Code-o-mat19-Jan-09 10:00
Code-o-mat19-Jan-09 10:00 
QuestionHow to determine programatically if a drive letter (for example, 'E:\') is a CD/DVD device? [SOLVED] Pin
sashoalm19-Jan-09 5:32
sashoalm19-Jan-09 5:32 
AnswerRe: How to determine programatically if a drive letter (for example, 'E:\') is a CD/DVD device? Pin
Randor 19-Jan-09 5:52
professional Randor 19-Jan-09 5:52 
GeneralRe: How to determine programatically if a drive letter (for example, 'E:\') is a CD/DVD device? Pin
sashoalm19-Jan-09 6:16
sashoalm19-Jan-09 6:16 
GeneralRe: How to determine programatically if a drive letter (for example, 'E:\') is a CD/DVD device? [modified] PinPopular
Randor 19-Jan-09 9:53
professional Randor 19-Jan-09 9:53 
AnswerRe: How to determine programatically if a drive letter (for example, 'E:\') is a CD/DVD device? [SOLVED] Pin
Hamid_RT20-Jan-09 19:55
Hamid_RT20-Jan-09 19:55 
QuestionIs it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Ahmed Charfeddine19-Jan-09 4:04
Ahmed Charfeddine19-Jan-09 4:04 
AnswerRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Stuart Dootson19-Jan-09 4:16
professionalStuart Dootson19-Jan-09 4:16 
You can't instantiate an abstract class. Full stop. No argument. All you can do is derive a class from the abstract class that implements the abstract method(s) and instantiate one of those. The derived class pointer is convertible to a pointer to the abstract base class, so can be used in its place - see the code below.

class A{
public :
A(){};
virtual ~A(){};
virtual void do()=0;
};

class B : public A
{
public:
  B() {}
  virtual ~B() {}
  virtual void do() { std::cout << "In B::do\n"; }
}

void Blah(A* pA) { pA->do(); }

void main()
{
  B* pB=new B();//No error
  Blah(pB);
}


I've also made the destructor virtual - it's always safest to make destructors virtual if a class has any virtual method, in case the destructor gets called from a base class pointer/reference.
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Ahmed Charfeddine19-Jan-09 4:25
Ahmed Charfeddine19-Jan-09 4:25 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
CPallini19-Jan-09 4:35
mveCPallini19-Jan-09 4:35 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Ahmed Charfeddine19-Jan-09 4:41
Ahmed Charfeddine19-Jan-09 4:41 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
CPallini19-Jan-09 5:10
mveCPallini19-Jan-09 5:10 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Stuart Dootson19-Jan-09 4:40
professionalStuart Dootson19-Jan-09 4:40 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Ahmed Charfeddine19-Jan-09 4:47
Ahmed Charfeddine19-Jan-09 4:47 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Luc Pattyn19-Jan-09 5:19
sitebuilderLuc Pattyn19-Jan-09 5:19 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Stuart Dootson19-Jan-09 6:48
professionalStuart Dootson19-Jan-09 6:48 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Stuart Dootson19-Jan-09 6:54
professionalStuart Dootson19-Jan-09 6:54 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Ahmed Charfeddine19-Jan-09 22:14
Ahmed Charfeddine19-Jan-09 22:14 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Luc Pattyn19-Jan-09 4:40
sitebuilderLuc Pattyn19-Jan-09 4:40 
AnswerRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
«_Superman_»19-Jan-09 16:05
professional«_Superman_»19-Jan-09 16:05 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
ThatsAlok19-Jan-09 21:52
ThatsAlok19-Jan-09 21:52 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Stuart Dootson19-Jan-09 22:11
professionalStuart Dootson19-Jan-09 22:11 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
«_Superman_»19-Jan-09 23:36
professional«_Superman_»19-Jan-09 23:36 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? Pin
Ahmed Charfeddine19-Jan-09 22:13
Ahmed Charfeddine19-Jan-09 22:13 
GeneralRe: Is it theoretically possible to instantiate an abstract C++ class ? How ? [modified] Pin
Stuart Dootson19-Jan-09 22:36
professionalStuart Dootson19-Jan-09 22:36 

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.