Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!linus!raybed2!applicon!bambi!boning!boning From: boning@boning.applicon.UUCP Newsgroups: comp.lang.c++ Subject: Function Arguments Message-ID: <31900002@boning> Date: Tue, 26-May-87 14:58:00 EDT Article-I.D.: boning.31900002 Posted: Tue May 26 14:58:00 1987 Date-Received: Sun, 31-May-87 20:48:52 EDT Lines: 36 Nf-ID: #N:boning:31900002:000:1084 Nf-From: boning.applicon.UUCP!boning May 26 14:58:00 1987 I'm new to C++ and I've come across a problem trying to use derived classes as argument types for base class functions. Suppose I have a base class and another class derived from the base class. I must declare the base class before the derived class. Then, if I try to use the derived class as an argument to a function in the base class the compiler signals an error since the derived class hasn't been defined yet. Is there any way to use a derived class as an argument to a base class? I don't want to use a void pointer and lose type checking. The example I'm thinking of is a base class 'geometry' which has derived classes 'edges' and 'polygons'. I want to have a function 'get_edges' under 'geometry' which will find the edges belonging to a piece of geometry, ie class geometry { public: void get_edges(edges *); }; class edges: public geometry { ... }; Can I do this in C++? Thanks in advance, Peggy Boning. {allegra|decvax|harvard|yale|mit-eddie|mirror}!ima!applicon!boning, ...!ulowell!applicon!boning, or ...!raybed2!applicon!boning