Viewing an algebraic subset through hyperplane sections

Suppose $$n \ge 3$$ and $$X$$ is a path-connected subset of $$\Bbb{CP}^n$$ under the manifold topology. If for every complex hyperplane $$H \subset \Bbb{CP}^n$$, $$H \cap X$$ is a degree $$k$$ algebraic hypersurface in $$H$$ (could be singular or reducible), is it true that $$X$$ itself is a degree $$k$$ algebraic hypersurface in $$\Bbb{CP}^n$$? This question arose when I was constructing an algebra-free definition of quardric surface (where $$n=3$$ and $$k=2$$ respectively), and I have no idea how to prove or disprove this.
Appendix: The $$n=2$$ case can be easily proved to be false as stated in the comment. However the reason might be that a "hypersurface" in $$\Bbb{CP}^1$$ is just a set of finite points, thus no enough rigidity occurs. I wonder whether things change in higher dimensions.

• For $n=2$, wouldn't any subset $X$ that intersects any line in finitely many points (but at least one) be a counterexample? There certainly exist such subsets that are not algebraic hypersurfaces. Jan 12 at 3:45
• For $n=2$, the OP is requiring that the intersection with every line is a fixed number of points (possibly with multiplicity), say $k$. Is there a $X$ with this property that is not an algebraic curve of degree $k$? Jan 12 at 6:32
• @AntoineLabelle Just as Francesco Polizzi said, a degree $k$ "hypersurface" in $\Bbb{CP}^1$ is the zero locus of a single degree $k$ polynomial, which is $k$ points with multiplicity. Jan 12 at 11:35
• For an arbitrary subset of $\mathbb{CP}^2$, how are you defining "intersection multiplicity" for the intersection with a line at a point? I do not understand your hypothesis for subsets of $\mathbb{CP}^2$. Jan 12 at 11:50
• Then the result is wrong. Start with a plane curve and remove a subset. Jan 12 at 11:55