🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools.misc
Article #5

[Q] Why doesn't this compile?

#5
From: Ranko Orlic
Date: Wed, 17 Apr 1996 17:00
40 lines
1195 bytes
Using MSVC 4.0 compiler I get the following:

File test.cpp: ---------------------------------

class A {
public:
	class L {
	public:
		L() {}
		virtual void f() {
			int dummy = 0;
		}
	};
	A();
};

class B : public A {
	class L : public A::L {
	public:
		L() {}
		virtual void f() {
			A::L::f();
		}
	};
	B();
};

Compilation result: ----------------------------

test.cpp(18) : error C2352: 'A::L::f' : illegal call of 
nonstatic member function
Error executing cl.exe.
test.obj - 1 error(s), 1 warning(s)

------------------------------------------------

Anybody knows what's wrong with it?
Thanks,

-- Ranko.
Technical Details
Message-ID: <317523C0.5042@eps.agfa.be>
Path: arc1-ca.pugleaf.net!garfield.eps.agfa.be!lvhoof

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!garfield.eps.agfa.be!lvhoof
From: Ranko Orlic <rorlic@eps.agfa.be>
Newsgroups: comp.os.ms-windows.programmer.tools.misc,comp.os.ms-windows.programmer.win32,comp.os.ms-windows.programmer.misc,comp.lang.c++
Subject: [Q] Why doesn't this compile?
Date: Wed, 17 Apr 1996 19:00:48 +0200
Organization: Agfa-Gevaert NV.
Message-ID: <317523C0.5042@eps.agfa.be>
NNTP-Posting-Host: brussels.eps.agfa.be
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0 (WinNT; I)