|
I have three classes:
A data holder class CDataHolder, which uses a Pimpl pattern
class CDataHolder { public: // ... private: friend class CBase; struct PImpl; PImpl* iPimpl; };
A base class CBase, which need to access the iPImpl member in CDataHolder...
Started by douyw on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Since you have declared struct PImpl in the private part of CDataHolder class, only friends section or even better before the CDataHolder class?
Friend is (rightfully) very limited and can't aspect of it, or B) you need the DataHolder ....
|
|
I am trying to make a call to a Parent class method from a contained object, but have no luck with the following code. What is the standard way to do it?
I have searched around and this seems to work for inherited objects, but not for contained objects...
Started by LearningFast on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You'll have to pass 'this' down to the child (probablyA contained object has no special... .
For example:
class Child{ public: void doOtherThing( Parent & p ); }; void Child::doOtherThing no connection to the parent class at all.
|
|
Hello,
If both classes are placed in one unit - there is no problem,the child class inherits private methods from the parent class,but if they are in different units,the class can access only public methods.Why?
The child class can't access private methods...
Started by John on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
User ....
Protected methods can be accessed by any class that inherits from the base class even if they are in different units.
You should make them Protected , instead of Private
like so
type TMyClass = class(TObject) Private method.
|
Ask your Facebook Friends
|
I need to have a class constructor in PHP call its parent's parent's (grandparent?) constructor without calling the parent constructor.
// main class that everything inherits class Grandpa { public function __construct() { } } class Papa extends Grandpa...
Started by Paulo on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Constructor parent::__construct(); } } class Kiddo extends Papa { public function __construct Grandpa's constructor parent::__construct(); $this->prop1 = 'foobar'; } } class Kiddo extends the encapsulation of the Papa ....
|
|
Public class A { } public class B extends A { public void add() { System.out.println("add in B"); } }
Now here if we call add in following way hen it gives an error: A a1 = new B; a1.add();
But when we add the add() method in class A and then call in ...
Started by Mohit on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
It is legal in this case to perform a cast of a1 to B like A an abstract class and declare....
So the compilation fails, class A does not have add() in its API.
Is a reference to an object of class A, which does not have that method.
|
|
I have 2 classes, a parent and a child.
Class Test Private Test_Text Private Sub Class_Initialize() Test_Text = "Hello" End Sub Private Sub Class_Terminate() End Sub Public Property Get Text Text = Test_Text End Property Public Property Let Text(ByVal...
Started by Tester101 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Is a pseudo-code example:
class Engine [method] start() class Car [property] Engine
Ideally you would want.
|
|
Hi,
How do i call a function of a child class from parent class? Consider this:
class whale { function __construct() { // some code here } function myfunc() { // how do i call the "test" function of fish class here?? } } class fish extends whale { function...
Started by Sarfraz on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
The true problem here is that a parent class, and....
In a child class from a parent class that doesn't exist in your parent class then your abstraction is expensive and should only be used when necessary.
|
|
I've been to jquery select class inside parent div and Testing objects for ancestor/descendent relationship in JavaScript or Jquery and jQuery wild card character but can't seem to fit the pieces together. Thanks.
<div id="viewContainerTop" class="...
Started by GollyJer on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
$("#viewContainerTop > div:not(.row2)").hide();
Machting the code you posted (parent has id viewContainerTop)
$("#viewContainerTop > div:not(.row2)").hide();
Matching what you wrote (parent has class not id viewContainerTop....
|
|
I'm sorry for my silly question, but... let's suppose I have this classes:
class A(): msg = 'hehehe' class B(A): msg = 'hohoho' class C(B): pass
and an instance of B or C. So, how to get the variable 'msg' from the parent's class object through this instance...
Started by PyNewbie on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
But as you define the classes and you now that B inherits from A you can always do this:
class B(A): msg = 'hohoho' def get_parent(instance, attribute....
Remember that Python supports multiple inheritance.
parent class.
|
|
Hi,
I'm trying to select a class inside the same parent class of a link.
This is the html:
<div id="productList"> <ul> <li class="productListItem"> Product 1 <span class="smallText">stuff</span> <div class="skuFinder"&...
Started by sf on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
And is anywhere inside li with //class productListItem) $(this).closest("li.productListItem").find("div.skuFinder"); });
Try:
$('a.merchantLink').click(function(){ var el = $(this).parent().siblings.
|