Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is MSVC broken!

Status
Not open for further replies.

Dhafir

Programmer
Sep 22, 2002
28
0
0
NZ
Try this code:

class Movie
{
public:
Movie(int i)
{
this->i=i;
}

~Movie(){ }

virtual void show() const =0;
private:
int i;

};


///////////////////////////////////////////////
int main(int argc,char **argv)
{

(Movie(6)).show(); // this line compiles Ok !

return 1;
}

MSVC allows you to create a temporarly object of an abstract class!
It failes, however, at run time!
What a shame !
 
Yep, you're right. It will compile.....
But it's no wonder that it fails at runtime.
Greetings,
Rick
 
It doesn't compile on VC7 (Visual Studio .net)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top