:orphan:
# PetscObject
any PETSc object, `PetscViewer`, `Mat`, `Vec`, `KSP` etc
## Synopsis
```
typedef struct _p_PetscObject *PetscObject;
```
## Notes
This is the base class from which all PETSc objects are derived from.
In certain situations one can cast an object, for example a `Vec`, to a `PetscObject` with (`PetscObject`)vec
## See Also
`PetscObjectDestroy()`, `PetscObjectView()`, `PetscObjectGetName()`, `PetscObjectSetName()`, `PetscObjectReference()`, `PetscObjectDereference()`
## Level
beginner
## Location
include/petscsystypes.h
## Examples
src/dm/dt/dualspace/impls/lagrange/tutorials/ex1.c
src/dm/dt/dualspace/impls/lagrange/tutorials/ex2.c
src/dm/field/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex10.c
src/dm/impls/plex/tutorials/ex11.c
src/dm/impls/plex/tutorials/ex13.c
src/dm/impls/plex/tutorials/ex14.c
src/dm/impls/plex/tutorials/ex5.c
src/dm/impls/plex/tutorials/ex6.c
src/dm/impls/plex/tutorials/ex7.c
src/dm/impls/plex/tutorials/ex8.c
## Implementations
_p_PetscObject in include/petsc/private/petscimpl.h
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscsystypes.h)
[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)