How to implement Object using template class

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By yukkysaito

Hi, I’m yukky and I’m still new to godot.

I’m developing the visualizer for autonomous driving called Autoware

I have one question.
How to implement an object using template class and inherit?

In detail, there is the following PointCloud class.
I want to call is_new by PointCloud instance from GDScript.
But I get the following error.

SCRIPT ERROR: Invalid call. Nonexistent function 'is_new' in base 'PointCloud'.  

Could you help me?
Also I don’t know what difference GDCLASS, _bind_methods and register_class.


sample codes : all codes
topic_subscriber.hpp

template <class T>
class TopicSubscriber : public Reference
{
   	GDCLASS(TopicSubscriber, Reference);
   	// GDCLASS(TopicSubscriber<T>, Reference);
public:
	bool is_new();
protected:
   	static void _bind_methods()
   	{
		ClassDB::bind_method(D_METHOD("is_new"), &TopicSubscriber::is_new);
		// ClassDB::bind_method(D_METHOD("is_new"), &TopicSubscriber<T>::is_new);
	}
}

pointcloud.cpp and pointcloud.hpp

class PointCloud : public TopicSubscriber<sensor_msgs::msg::PointCloud2>
{
	GDCLASS(PointCloud, Reference);
    ...
protected:
	static void _bind_methods()
	{
	// ClassDB::bind_method(D_METHOD("is_new"), &PointCloud::is_new);
	}
}

register_types.cpp

void register_godot_rviz2_types()
{
	ClassDB::register_class<PointCloud>();
}