Tag Archives: object

(JavaScript) Javascript Module Pattern

The module pattern was originally defined as a way to provide both private and public encapsulation for classes in conventional software engineering. In JavaScript, the module pattern is used to further emulate the concept of classes in such a way that we’re able to include both public/private methods and variables inside a single object, thus [...]

Posted in JavaScript | Also tagged , , , , | Leave a comment

Classes in C++

C++ can be used for object-oriented programming. This example shows you how to define a class and a header file belonging to it.

Posted in C++ | Also tagged , , , , , , , | Leave a comment

Constructors and destructors in PHP

You might want to execute code when an instance of an object gets constructed or destructed. PHP offers constructors and destructors for this purpose. A constructor can be created by declaring a function called __construct within a class and a destructor can in turn be created by declaring a function called __destruct. <?php class Foo [...]

Posted in PHP | Also tagged , , , , , , | Leave a comment