🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by kenny Wed, 24 Jan 1990 08:13
extern versus abstract functions
#255
Author: kenny
Date: Wed, 24 Jan 1990 08:13
32 lines
1274 bytes
If I have a class with abstract virtual functions, as in

class foo {
	char bar;
public:
	virtual void do_something () const = 0;
};

I can't declare an extern variable belonging to that class:

extern foo zot;

The reason I want to do this is that I'm creating zot in another .cc
file with:

class quux : public foo {
public:
	void do_something ();
} zot;

with the virtual function supplied; I just want to hide zot's derived
class from the users of foo.  (This is primarily for expandability --
I want to be able to derive new classes from foo without having to
recompile the whole world).

It seems to me that there's no problem with accepting the extern
declaration; the compiler isn't actually constructing an instance of
foo, as it would if the `extern' keyword were not supplied.  Am I
missing something?

Kevin	KE9TV
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads