Code Monkey home page Code Monkey logo

Comments (4)

idea4good avatar idea4good commented on August 25, 2024

virtual c_wnd* clone(){return new c_button();}
clone function will be used when you want clone a same UI, even it is rarely used.
You refer to this code: clone 8 mini UI

from guilite.

Wanderson4096 avatar Wanderson4096 commented on August 25, 2024

This clone function will not actually clone the object. You are creating a default object (using the default constructor) and not a copy. To actually build a copy of the object, you have to pass a pointer to this object (*this) as the constructor parameter, like this:

virtual c_wnd* clone(){return new c_button(*this);} // Makes a copy and returns a pointer to it.

from guilite.

idea4good avatar idea4good commented on August 25, 2024

Maybe the name "clone" is not accurate.
We just want a new c_wnd object, but do not want it's the same as its father.

from guilite.

idea4good avatar idea4good commented on August 25, 2024

remove the function

from guilite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.