Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
example-12-mini-shape-system
============================

A capstone showcase. Builds a small shape hierarchy with multiple
inheritance:

        Shape
       /     \
    Circle  Colored        (Colored is a mixin)
       \     /
     ColoredCircle

Exercises most of the system in one program:

  * single and multiple inheritance, with the resulting lookup order
  * instance variables + a shared `InstanceCount` class variable
  * a class-side `New` constructor that bumps the count and returns a
    fresh instance, inherited by every Shape subclass
  * generic dispatch for `Describe` and `Area` across the hierarchy
  * a reflection dump listing every class and every generic

Output includes the computed areas of the constructed shapes, the
multi-inheritance lookup order of `ColoredCircle`, and a roster of all
generics in the world.

Build / run / clean
-------------------
Run any of these from this directory:

    make build
    make run
    make clean

Equivalent cargo commands from the workspace root (Dynace-RS/):

    cargo build -p example-12-mini-shape-system
    cargo run   -p example-12-mini-shape-system
    cargo clean -p example-12-mini-shape-system

The built executable
--------------------
After a build, the standalone binary lives at:

    <workspace-root>/target/debug/example-12-mini-shape-system

(or `target/release/...` if built with `cargo build --release`). It's a
normal native executable that links only to libc and libgcc_s, so you can
copy or move it anywhere on a compatible system and run it directly.

Using this as a starter project
-------------------------------
This directory is self-contained — you can copy it anywhere on your
machine and use it as the seed for your own application:

    cp -r <Dynace-RS>/examples/12-mini-shape-system ~/my-app

Then open the copied `Cargo.toml` and adjust the `dynace` dependency
path to point at wherever Dynace-RS lives on your system, e.g.:

    dynace = { path = "/abs/path/to/Dynace-RS/crates/dynace" }
    dynace = { git = "https://github.com/your-user/Dynace-RS.git" }

After that, `make build` / `make run` / `make clean` work as usual,
and the resulting binary lands in `target/debug/...` of your copied
project.