Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.
0
votes
2answers
46 views
Subclass template in C++
I know in java we can do this:
class A<T extends B>
{
...
}
Can we do the same with templates in C++?
For example i want to have a templated class A in witch the template T that we pass are ...
4
votes
4answers
42 views
Is it proper for equals() to depend only on an ID?
Let's suppose I have class User:
public class User {
private Long id;
private String name;
private Integer age;
private BigDecimal account;
// other fields, getters and setters
}
Is it ...
0
votes
2answers
26 views
How to avoid passing object in the same class in PHP?
My Class looks like:
class MyDBClass extends SQLite3{
function __construct()
{
$this->open('/path_of_file');
}
public function saveArticle($product, ...
0
votes
1answer
60 views
getting a pointer or reference to the base class c++
Suppose I have 3 classes class BaseA, class BaseB and class DerivedC (all forward delcared).
class BaseA
{
public:
BaseA();
BaseA(const BaseB&);
};
and
class BaseB
{
public:
...
0
votes
2answers
41 views
Find if object belongs to class in C++
I'm trying to make my own CBGE (Component Based Game Engine) in C++ but i am stuck at this question: How to i find if an Object belongs a specific class? Or equivalent with pointers, how do i find if ...
-1
votes
0answers
18 views
hierachical array of classes: python and uml
I have a hierarchy of classes where each next class contains as a attribute an array of objects of a previous class plus some additional attributes and methods. What is the most smart way to organize ...
0
votes
5answers
85 views
Why this method overloading anomaly?
I have seen numerous posts debating about overloading a method by changing its return type, but, the following program should ideally work fine, because the variable i of type integer can only hold ...
-1
votes
2answers
42 views
Writing a class object into a file using fstream and then read it
I want to make a class of a student and take 3 inputs information and make an output of this file. How to this? This is my try:
#include <iostream>
using namespace std;
class Student{
...
2
votes
1answer
48 views
Difference between calling a method and accessing an attribute
I'm very new to Python, and I'm using Python 3.3.1.
class Parent: # define parent class
parentAttr = 100
age = 55
def __init__(self):
print ("Calling parent constructor")
...
-2
votes
1answer
35 views
Is __destruct() called when the same object has another instance? [closed]
This is pretty short question. Is __destruct called whenever i instantiate the same object again? (in PHP)
0
votes
1answer
25 views
php file having wrapper class instead of arguments in file's functions
I've the following files:
`index.php`
`settings.php`
`functions.php`
settings.php:
....
$object = new SomePhpClass();
....
index.php:
require_once('settings.php');
...
-1
votes
0answers
20 views
I can't use same object trough PHP pages and Smarty Templates
I am studying to create a Web App professionally. I bought the book "Professional PHP5" (ISBN: 0-7645-7282-2). The problem I have is when I click on link Customer Contacts (customer-contacts.php) at ...
0
votes
1answer
50 views
Should I use public methods or writeonly properties in my class?
I have a class library that contains a class. The class is responsible to form a connection between the program and the database and provide me with the connection string :
public class DBcon
{
...
3
votes
3answers
74 views
Inheritance in JavaScript causes Uncaught TypeError
May be I'm missing something here. Please bear with me as I'm new to OOP in javascript. But I need to find a solution to my problem.
I have this code.
var parent = function() {}
...
0
votes
0answers
28 views
Auto-Generated Interface Implementation
When implementing the IDisposable interface, the Must-Override method: Dispose; is auto-generated. That auto-generated method has a very small amount of code and comments. I'd like to do the same ...