Abstract actor classes can be summoned

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!

Abstract actor classes can be summoned

Postby Player701 » Thu Nov 21, 2019 2:29 am

ZScript allows defining abstract classes, intended to serve as parents for one or more concrete subclasses with shared logic and/or interface. As in many other programming languages, attempting to create an instance of an abstract class will cause an error:

Code: Select allExpand view
class TestClass abstract
{
    static TestClass Create()
    {
        return new('TestClass'); // Error: Cannot instantiate abstract class TestClass
    }
}

While there's no doubt that this behavior is certainly intended, there is also an inconsistency: abstract classes can still be instantiated with the "summon" console command, provided that they inherit from Actor. This should probably not be allowed.

(As a side note, I wish there were real abstract methods in ZScript...)
User avatar
Player701
 
Joined: 13 May 2009
Location: Russian Federation
Discord: Player701#8214
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Return to Bugs

Who is online

Users browsing this forum: _mental_ and 17 guests