:orphan:
# PetscObjectGetClassName
Gets the class name for any `PetscObject`
## Synopsis
```
#include "petscsys.h"
PetscErrorCode PetscObjectGetClassName(PetscObject obj, const char *classname[])
```
Not Collective
## Input Parameter
- ***obj -*** any PETSc object, for example a `Vec`, `Mat` or `KSP`.
Thus must be cast with a (`PetscObject`), for example,
`PetscObjectGetClassName`((`PetscObject`)mat,&classname);
## Output Parameter
- ***classname -*** the class name, for example "Vec"
## See Also
`PetscObject`, `PetscClassId`, `PetscObjectGetType()`, `PetscObjectGetClassId()`
## Level
developer
## Location
src/sys/objects/gcookie.c
## Examples
src/mat/tutorials/ex7.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/gcookie.c)
[Index of all Sys routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)