How to find derived classes in a solution in Visual Studio 2013? - c++

In Visual Studio 2013 when I go to Class View, then search for a class, then expand "Derived Types" folder it shows me only the classes derived from this class in the current project, but not the whole solution. Is there a way to find all the derived classes in the solution in Visual Studio 2013 or perhaps some plugins? The language in focus is C++ (unmanaged).

I have the same question. So far I am making do with a regular expression that matches part of the declaration of the derived class:
:\s*(public|private|protected)?\s+ClassName
For example when searching for all classes derived from class A in the following:
class B : public A {};
The regular expression tries to match the : public A. Note this will not work when A is not first base class in the list of base classes. Also does not work for indirect descendants.

Related

Skip class from UnitTest - Visual Studio 2019

How to Skip class from unittest in visual studio 2019
ClienteRepositoryTests extends RepositoryTestBase.
RepositoryTestBase is a base for all unittests. I'd like that RepositoryTest dont show in Test Explorer
Make the base class abstract.
Both XUnit and MSTest (and probably other frameworks) use reflection to find correctly decorated methods (or types) and have to instantiate them in order to run the tests. If your class is abstract, the method will still exist on the derived type (still decorated as a test method), but the base class cannot be instantiated.

VS2013 compiler: 'CObject::CObject' : cannot access private member declared in class 'CObject'

I'm trying to migrate a project from to c++11 in Visual Studio. I fixed a number of issues, but there's one remaining which I can't seem to crack with MFC:
error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' (file.cpp)
: see declaration of 'CObject::CObject'
: see declaration of 'CObject'
This diagnostic occurred in the compiler generated function 'CList<ParameterValue,ParameterValue &>::CList(const CList<ParameterValue,ParameterValue &> &)'
This is code that hasn't changed on our end and has been compiling fine when targeting the Visual Studio 2010 toolset. From what I could gather it doesn't seem like the definition of CObject has changed either which makes it all the stranger.
There's other similar questions reported here, but I couldn't find a solution to my problem there. In most other cases it would appear the issue comes from a lack of public default constructors, Copy constructors, or assignment operators.
Our class that extends CList however provides public versions of all these, and ParameterValue does not inherit from CObject.
class __declspec(dllexport) GParameterValueList : public CList<ParameterValue, ParameterValue&>
{
// ParameterValue is a struct that DOES NOT inherit from CObject (or anything)
public:
GParameterValueList();
GParameterValueList(const GParameterValueList& SrcList);
GParameterValueList& operator=(const GParameterValueList& SrcList);
}
Any help would be appreciated.
P.S.Our implementation is exported into a DLL, I'm wondering if that might be causing some conflicts?
Edit: Not a duplicate of error using CArray or error using CArray -> in these the CObject derived classes were missing public default and copy constructors. As described above, this is not the case with our code.
I think the problem is in your ParameterValue class. Try to declare public constructors in there, including the default constructor.
It seems to me that the CList tries to call the ParameterValue constructor somewhere, but the former can't because the latter is private.
Alternatively, try to use a List of Pointers, like CList<ParameterValue*, ParameterValue*&>.
Another alternative is to use a std container instead of CList.

How can I find out which method of a derived class is not implemented?

I have an abstract base class, where some functions are implemented and some are purely virtual.
From this base class, I have created a derived class which implements all virtual functions.
However, it still complains that the derived class is abstract. I assume that I have forgotten to implement one method, but I cannot see which one. Is there any way to get a list of inherited virtual methods? I am using Visual Studio 2010.
When compilation fails due to an abstract class instantiation attempt you should
get the exact method that is missing in the output tab, see the following example:
8>MVSystemTesting\ReportsServiceMock.cpp(10): error C2259: 'CMailslotIPCChannel' : cannot instantiate abstract class
8> due to following members:
8> 'void CIPCChannelBase::Listen(void)' : is abstract
8> d:\tfs\IPCChannelBase.h(27) : see declaration of 'CIPCChannelBase::Listen'
Here you can see that Listen is not implemented.
This is how you open the output tab:

inheritance in MS C++ using Visual Studio 2010

i have been going through the source code of an application which i downloaded from sourceforge.
i have a certain method which requires a pointer to an abstract class as a parameter.
class A;//abstract class
B::method(A *)
i cant create an object of A since its abstract.
so i can only pass pointer to object of child class of A in the B::method().
Now the problem is there are many classes in the source.
my problem is that how do i know which are the child classes of a parent class in visual studio 2010?
i have tried "find all references" for a virtual method of the abstract class (because its definition should be in the child class!) but without luck.
hope i could make my question clear!
Maybe "Solution Explorer" -> Your project -> Right Click Menu -> "Class Diagram" is what you're looking for ?
Another suggestion - try looking for " : public YourBaseClassName" strings and then "unwind" the inheritance. The usability certainly depends on the depth of your hierarchy. If there are multiple intermediate classes or multiple inheritance, then... Maybe, look at Eclipse+CDT ?

public inheritance and tlb files

Say you have two assemblies (two dlls). The first contains a class called Base and the second contains a class called Derived which publicly inherits from Base.
When I use the tlb files to create C++ classes in Visual Studio 2005, I get Base and Derived classes, but one is not a subclass of the other. There doesn't seem to be any IS-A relationship. Is there a reason for this?
I'm assuming here, that the two assemblies communicate one with the other via COM, if that is indeed the case then you are correct, there is no IS-A relationship in COM in regard to CLASS inheritance, only in regard to Interface inheritance.
If you were to define an interface IBase and IDerived which derives from IBase, then you would be able to cast IDerived to IBase on the same object which implements both.