oop Questions

4

I have created a class 'validate' to validate two fields i.e 'firstname' and 'lastname'. It is not working fine, it is showing error when field is empty but when I submit the form with non-empty fi...
Systemic asked 12/4, 2017 at 15:27

4

Solved

I've been using object-oriented programming practices for 25 years and trying to move toward functional programming for the last 5 years, but my mind always goes towards OOP when I'm trying to do s...
Transpose asked 30/4, 2017 at 10:51

6

Solved

Lua does not have build in support for OO, but it allows you to build it yourself. Could you please share some of the ways one can implement OO? Please write one example per answer. If you have mo...
Interlinear asked 25/1, 2011 at 21:30

2

Or is that considered bad practice or something? I have one notification triggers 4-5 handlers, which in turn call database to retrieve data. Each those calls can also be called separately,...
Twitter asked 1/3, 2018 at 3:23

1

Solved

Please explain why the following errors do/don't occur: ff = factor(1:3) `[.factor`(ff) # okay base::`[.factor`(ff) # Error in NextMethod("[") : 'NextMethod' called from an anonymous func...
Rok asked 5/2 at 19:22

23

Solved

I created a JavaScript object, but how I can determine the class of that object? I want something similar to Java's .getClass() method.
Laux asked 8/8, 2009 at 18:11

12

I want to save my time and reuse common code across classes that extend PIXI classes (a 2d webGl renderer library). Object Interfaces: module Game.Core { export interface IObject {} export inter...
Disyllable asked 15/11, 2014 at 17:9

4

Solved

I have the following class which I'm using as the base of all the models in my project: public abstract class BaseModel { static String table; static String idField = "id"; public static bool...
Monochord asked 18/10, 2013 at 18:56

11

Solved

I have a class that contains only fields and no methods, like this: class Request(object): def __init__(self, environ): self.environ = environ self.request_method = environ.get('REQUEST_METHOD...
Cabe asked 28/10, 2010 at 16:44

2

Solved

Take a look at this example, and notice the outputs indicated. <?php class Mommy { protected static $_data = "Mommy Data"; public static function init( $data ) { static::$_data = $data; ...
Biller asked 2/1, 2011 at 4:51

5

Solved

What are advantages of using UserDict class? I mean, what I really get if instead of class MyClass(object): def __init__(self): self.a = 0 self.b = 0 ... m = MyClass() m.a = 5 m.b = 7 I will wr...
Piny asked 8/9, 2009 at 7:0

8

Solved

I have this method that I want to use $this in but all I get is: Fatal error: Using $this when not in object context. How can I get this to work? public static function userNameAvailibility() { ...
Moten asked 18/2, 2010 at 6:18

8

Solved

Like most developers here and in the entire world, I have been developing software systems using object-oriented programming (OOP) techniques for many years. So when I read that aspect-oriented pro...
Mahone asked 24/10, 2008 at 9:0

13

Solved

I've created a Javascript object via prototyping. I'm trying to render a table dynamically. While the rendering part is simple and works fine, I also need to handle certain client side events for t...
Particularly asked 27/8, 2009 at 2:44

4

Solved

I have an Interface which contains one property. I need to set the default value for that property. How to do that?. Also is it good practice to have a default value for a property in Interface? or...
Humber asked 12/10, 2011 at 5:20

9

Solved

How do I call the parent function from a derived class using C++? For example, I have a class called parent, and a class called child which is derived from parent. Within each class there is a pri...
Apatite asked 10/12, 2008 at 19:35

2

Solved

I want to be able to proxy all methods of a class inside the constructor of a class itself. class Boy { constructor() { // proxy logic, do something before each call of all methods inside class ...
Quaquaversal asked 6/11, 2021 at 1:34

3

Solved

As of Java 9, methods in an interface can be private. A private method can be static or an instance method. Since private methods can only be used in the methods of the interface itself, their use...
Psychoanalysis asked 7/10, 2019 at 1:40

5

Solved

Minimal example of the class: from pydantic import BaseModel class AdaptedModel(BaseModel): def get_all_fields(self, alias=False): return list(self.schema(by_alias=alias).get("properties&qu...
Riding asked 19/2, 2022 at 10:11

8

Solved

My idea was to implement the following class: class name(object, name): def __init__(self, name): print name Then the idea was to create two instances of that class: person1 = name("jean&qu...
Consolidate asked 15/6, 2016 at 14:0

2

I would like to type hint class name in method parameter, in this code: public function addScore($scoreClassName): self { $this->score = new $scoreClassName($this->score); return $this; ...
Crotty asked 4/12, 2019 at 9:48

5

Solved

Is there some equivalent of "friend" or "internal" in php? If not, is there any pattern to follow to achieve this behavior? Edit: Sorry, but standard Php isn't what I'm looking for. I'm looking f...
Staciestack asked 25/11, 2008 at 16:0

4

How can I pass an object as an argument to a class method and call the method of the passed object when the class method is called? Say I have: class myclass: def __init__(self): pass def myfu...
Finn asked 14/7, 2012 at 0:57

6

Given this code: trait Base { fn a(&self); fn b(&self); fn c(&self); fn d(&self); } trait Derived : Base { fn e(&self); fn f(&self); fn g(&self); } struct S; ...
Countertype asked 20/2, 2015 at 15:49

3

Solved

I have seen an example on Stackexchange (please note the trait accessing the class property): trait CheckPermissionTrait { protected function checkPermission($object_id) { $judge = $this-&gt...
Goethe asked 11/5, 2016 at 9:24

© 2022 - 2024 — McMap. All rights reserved.