I'm using VS2022 in C++, I came from the land of Java where the IDE suggest me all the methods that must be implemented if I'm extending an abstract class.
I'd like to do the same in C++ with virtual parent.
EX: (java) - In Eclipse it works like magic
abstract class Person {
abstract public String greet();
public void setName(String name){this.name = name;}
protected String name;
}
class Italian extends Person{
public String greet(){ return "Ciao, mi chiamo "+ name; }
}
class Brit extends Person{
public String greet(){ return "Hello, I'm "+ name; }
}
class German extends Person{
/* HINT BY THE IDE ASKING ME TO IMPLEMENT THE METHOD GREET*/
}
In C++ in MSVS
//World.h
#pragma once
class Person{
protected:
std::string m_name;
public:
//method marked as need implementation
virtual std::string greet() = 0;
void setName(const std::string& name){ m_name=name;}
}
class Italian : Person{
std::string greet(){ return "Ciao, mi chiamo "+m_name}
}
class Brit : Person{
std::string greet(){ return "Hi, I'm "+m_name; }
}
class German : Person{
/* the intellisense suggest me adding a constructor but not to implement the greet() method*/
}
How do I tell VisualStudio to prompts me to add the method implementation (adding an empty one if possible)?
From the document: Implement Pure Virtuals
Mouse Right-click and select the Quick Actions and Refactorings menu and select Implement all Pure Virtuals for class 'ClassName' from the context menu, where ClassName is the name of the selected class.