How To Use Classes In Dev C++

newlynx
3 min readNov 6, 2021

Download here

You can add a generic C++ class by using Class View. A generic C++ class is a class that you define or that is derived from a class that you define.

How to use Dev-C Introduction Dev-C is a full-featured integrated development environment (IDE), which is able to create Windows or DOS-based C/C programs using the Mingw compiler system (included with the package), or the Cygwin compiler. When I was a newcomer to the C scene, I personally, had a fair bit of trouble trying to figure out how to keep classes separate from the main.cpp file. So I figured I would pass my knowledge around on here to help others who are starting to learn C — we will use a ‘Person’ class as an example. In this particular case, the class (type of the objects) is Rectangle, of which there are two instances (i.e., objects): rect and rectb. Each one of them has its own member variables and member functions. Notice that the call to rect.area does not give the same result as the call to rectb.area.

To add a generic C++ class to a project:

C++ Program Examples With Classes

  1. In Class View, right-click the project to which you want to add the new class, choose Add, and then choose Class.
  2. In the Add Class dialog box, in the templates pane, select C++ Class. Select Add to display the generic C++ class wizard.
  3. In the wizard, provide a class name, and then define settings or accept the defaults.
  4. To close the wizard and view the new generic C++ class in the project, select Finish.

In this section

Classes In C++ Programming

Generic C++ class wizard

Adds a generic C++ class to a project. The class doesn’t inherit from ATL or MFC.

How To Use Classes In Dev C Pdf

  • Class name
  • Sets the name of the new class.
  • .h file
  • Sets the name of the header file for the new class. By default, this name is based on the name you provide in Class name. To save the header file to the location of your choice, or to append the class declaration to an existing file, select the ellipsis button (). If you specify an existing file and select Finish, the wizard prompts you to specify whether the class declaration should be appended to the file contents. To append the declaration, select Yes; to return to the wizard and specify another file name, select No.
  • .cpp file
  • Sets the name of the implementation file for the new class. By default, this name is based on the name you provide in Class name. To save the implementation file to the location of your choice, or to append the class definition to an existing file, select the ellipsis button (). If you specify an existing file and select Finish, the wizard prompts you to specify whether the class definition should be appended to the file contents. To append the definition, select Yes; to return to the wizard and specify another file name, select No.
  • Base class
  • Sets the base class for the new class.
  • Access
  • Sets access to the base class members for the new class. Access modifiers are keywords that specify the level of access that other classes have to the class member functions. For more information about how to specify access, see Member access control. By default, the class access level is set to public.
  • public
  • protected
  • private
  • Default (No access modifier is generated.)
  • Virtual destructor
  • Specifies whether the class destructor is virtual. Use of a virtual destructor helps make sure that the correct destructor is called when instances of derived classes are deleted.
  • Inline
  • Generates both the class constructor and the class definition as inline functions in the header file.
  • Managed
  • When selected, adds a managed class and header file. When cleared, adds a native class and header file.

Download here

--

--