473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

compilation issue

hi all ,

I am new to C++ programming. Can some body explain reason for this
compilation error,

.../inc/polecache.h", line 339: error #2322: object of abstract class
type
"CPoleCache::CCacheViewImpl" is not allowed:
pure virtual function "IViewObject::Draw" has no overrider
CCacheViewImpl m_View;
/\
I got this compilation error when compiling with "aC++/ANSI C A.06.05"
on
HP-UX 11i. This code was working fine with "aC++/ANSI C A.06.05" before
:)

Thanks,
Seema Rao

Mar 3 '06 #1
7 4955
dc
I think u try trying to create instance of abstract class or
derived class that has not implemented the pure virtual fn. of base
class.

It would be better if u can post some snippet of ur source code
seema wrote:
hi all ,

I am new to C++ programming. Can some body explain reason for this
compilation error,

../inc/polecache.h", line 339: error #2322: object of abstract class
type
"CPoleCache::CCacheViewImpl" is not allowed:
pure virtual function "IViewObject::Draw" has no overrider
CCacheViewImpl m_View;
/\
I got this compilation error when compiling with "aC++/ANSI C A.06.05"
on
HP-UX 11i. This code was working fine with "aC++/ANSI C A.06.05" before
:)

Thanks,
Seema Rao


Mar 3 '06 #2
Sorry I mean to say code was working fine with the "aC++/ANSI C
A.5.55". Now as I am trying to upgrade bits to aC++/ANSI C A.06.05
I am getting this error . Any clues?

Mar 3 '06 #3

seema wrote:
hi all ,

I am new to C++ programming. Can some body explain reason for this
compilation error,

../inc/polecache.h", line 339: error #2322: object of abstract class
type
"CPoleCache::CCacheViewImpl" is not allowed:
pure virtual function "IViewObject::Draw" has no overrider
CCacheViewImpl m_View;
/\ Could you check for the implementation of Draw method in CCacheViewImpl
class.
If it is not there, then you cannot create an object for CCacheViewImpl
class.

I got this compilation error when compiling with "aC++/ANSI C A.06.05"
on
HP-UX 11i. This code was working fine with "aC++/ANSI C A.06.05" before
:)

Thanks,
Seema Rao

Could you post the code of the base and derived classes so that we can
look into it furthur.

Mar 3 '06 #4
seema posted:
hi all ,

I am new to C++ programming. Can some body explain reason for this
compilation error,

../inc/polecache.h", line 339: error #2322: object of abstract class
type
"CPoleCache::CCacheViewImpl" is not allowed:
pure virtual function "IViewObject::Draw" has no overrider
CCacheViewImpl m_View;
/\
I got this compilation error when compiling with "aC++/ANSI C A.06.05"
on
HP-UX 11i. This code was working fine with "aC++/ANSI C A.06.05" before
:)

Thanks,
Seema Rao

Without seeing your code, my guess would be that you've left out an
ampersand in function argument list, eg.:

void Function( CPoleCache::CCacheViewImpl object ) //pass by value

instead of:

void Function( CPoleCache::CCacheViewImpl &object ) //pass by reference
-Tomás
Mar 3 '06 #5
On 03/03/2006, seema wrote:
I am new to C++ programming. Can some body explain reason for this
compilation error,

../inc/polecache.h", line 339: error #2322: object of abstract class
type
"CPoleCache::CCacheViewImpl" is not allowed:
pure virtual function "IViewObject::Draw" has no overrider
CCacheViewImpl m_View;
/\


In C++ an abstract class has at least one pure virtual function.

A pure virtual function is a function which is declared in its class
with the suffix "=0". This means that the function is not defined in
its class.

So an abstract class can't be used on its own to create an object. You
have to provide a derived class where all the pure virtual functions
are defined.

The error message is saying that you've tried to create an object of
abstract class type "CPoleCache::CCacheViewImpl", perhaps by creating
the object on the heap with "new", or creating the object on the stack
with
CPoleCache::CCacheViewImpl foo;

If you're new to C++, you definitely need this:
http://www.parashift.com/c++-faq-lite/

--
Simon Elliott http://www.ctsn.co.uk
Mar 3 '06 #6

Simon Elliott wrote:
A pure virtual function is a function which is declared in its class
with the suffix "=0".
Yes.
This means that the function is not defined in
its class.


Not necessarily. A pure virtual function can still have a definition.
Pure virtual implies that the definition *may* be omitted, not that the
definition *must* be omitted. And with a pure virtual destructor, you
will need to provide a definition (even if it is empty) or you will not
be able to link.

A class with one or more pure virtual functions is abstract. It does
not matter whether some or all of those functions have definitions.

Gavin Deane

Mar 3 '06 #7
On 03/03/2006, Gavin Deane wrote:
This means that the function is not defined in
its class.


Not necessarily. A pure virtual function can still have a definition.
Pure virtual implies that the definition may be omitted, not that the
definition must be omitted. And with a pure virtual destructor, you
will need to provide a definition (even if it is empty) or you will
not be able to link.


Yes. I didn't mention this because I wanted to keep things simple for
the OP. Herb Sutter's classic description of this here:

http://www.gotw.ca/gotw/031.htm

--
Simon Elliott http://www.ctsn.co.uk
Mar 3 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Novice | last post by:
Hi all, I'm afraid this is the second posting of this information as I didn't get a response on the previous post. I will try to shorten my message (i.e. be more concise) in the hopes that it will...
11
by: Michael Gaab | last post by:
Compilation in c generally has four phases 1. Preprocessing 2. Compilation 3. Assembly 4. Linking. If I use a flag that will not link the code, order of compilation is not an issue,...
1
by: Wei | last post by:
Hello, How to turn on "batch compilation" of ASP.NET application ? Though by default I think the asp pipeline should compile in batch mode, yet I set <compilation defaultLanguage="vb"...
6
by: thomson | last post by:
Hi all, I have compiled by .net web applicaion in my local machine , and a dll has been created on the bin Directory, And i have copied the entire application using xcopy deployment to a...
5
by: Rob | last post by:
By default, the web.config file of an ASP.NET application contains the following debug attribute for the compilation element: <compilation debug="true"/> My question is this: When doing the...
2
by: A_StClaire_ | last post by:
another question. this one more just a curiosity. why does Visual Studio 2005 "support" manual compilation of source code files only through the inconvenient command line? I see and understand...
3
by: sam_cit | last post by:
Hi All, I have the following scenario, A class is declared in the header file and has a static member function sample() in sample.h sample.cc uses the static member function sample(). the...
35
by: mwelsh1118 | last post by:
Why doesn't C# allow incremental compilation like Java? Specifically, in Java I can compile single .java files in isolation. The resulting individual .class files can be grouped into .jar files....
5
by: Rahul | last post by:
Hi Everyone, I have the following files, file.h typedef struct { int data;
1
by: Roumen Petrov | last post by:
Hi list members, It seems to me that this is discussed many times in the past but without progress. As I understand in general there is no objections and preferred cross-compilation has to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.