1

Using Visual Studio 2019 and C# (and new to Doxygen). Is it possible for a Doxygen comment from the base class method to be "applied" in Intellisense for derived classes (without actually having to write a Doxygen comment block for the method in the derived class itself)?

An example:

public abstract class MyBaseClass
{
    /// <summary>
    /// Something about this cool function
    /// </summary>
    protected abstract void CoolFunction();
}

public class MyDerivedClass1 : MyBaseClass
{
    protected override void CoolFunction()
    {
        // Do something specific to derived class 1...
    }
}

public class MyDerivedClass2 : MyBaseClass
{
    protected override void CoolFunction()
    {
        // Do something specific to derived class 2...
    }
}

//...
MyDerivedClass1 d1;
MyDerivedClass2 d2;
d1.CoolFunction();
d2.CoolFunction();

In the above example, hover the mouse over (say) d1.CoolFunction. Can the base class comment "Something about this cool function" be displayed? Currently basic prototype information is displayed, but nothing else.

This related question on PHP seems to give an answer but:

    1. I was not able to get it to work in C# (perhaps the syntax is slightly different?)
    1. This still requires writing a Doxygen comment block for each method in all derived classes, something I'd like to avoid if possible
AlainD
  • 5,413
  • 6
  • 45
  • 99
  • Which version of doxygen are you using? What are your settings in your doxygen settings file (Doxyfile) that are different from the standard settings (use: `doxygen -x Doxyfile` to see them). – albert Jul 22 '21 at 11:53
  • Thanks @albert. Where do I type that? I've tried in the command-prompt, and the Visual Studio `Powershell` terminal and they all say "doxygen is not recognized". I'm now wondering If I've miss-understood what I'm actually looking at! When I type `///` above any method, a Doxygen-like `/// ` block is automatically generated. Is that Doxygen or Visual Studio generating that block for Intellisense? – AlainD Jul 22 '21 at 12:03
  • I don't know where Visual Studio gets information from maybe it just shows the information from the doxygen style comments natively and hasn't even installed doxygen. The later looks like the case as you also mention that you just hover over a function call and it shows the docu. Probably the question has nothing to do with doxygen. Did you start doxygen from Visual Studio in one way or another? – albert Jul 22 '21 at 12:14

1 Answers1

1

You can try

/// <inheritdoc />

I'm not sure if it works with doxygen but it's the way to do for XML-documentation. See here

public abstract class MyBaseClass
{
    /// <summary>
    /// Something about this cool function
    /// </summary>
    protected abstract void CoolFunction();
}

public class MyDerivedClass1 : MyBaseClass
{
    /// <inheritdoc />
    protected override void CoolFunction()
    {
        // Do something specific to derived class 1...
    }
}

public class MyDerivedClass2 : MyBaseClass
{
    /// <inheritdoc />
    protected override void CoolFunction()
    {
        // Do something specific to derived class 2...
    }
}
Dirk
  • 308
  • 2
  • 11
  • quick grep on the sources and look in the documentation shows that doxygen supports the `` tag. – albert Jul 22 '21 at 12:15
  • That syntax works! Still requires the Doxygen-style comment block to be inserted above the derived method, though, which is a shame. – AlainD Jul 22 '21 at 13:22