Omgili - forum search, search forums  
  

Discussions about class derived

Displaying 1 - 10 out of 20,432 discussions.  
RSS Feed Options
Time Frame: (Any time)   Minimum number of replies: (2)   Minimum number of discussing users: (0)
  |  

Page: 1   2   3   4   5   6   7   8   9   10  
Keep this page open to be updated with the newest discussions automatically.
Can I force a parent class to call a derived class's version of a function? class Base(object): attr1 = '' attr2 = '' def virtual(self): pass # doesn't do anything in the parent class def func(self): print "%s, %s" % (self.attr1, self.attr2) self.virtual...
Started by on , 3 posts by 3 people.  
# do stuffIf you instantiate ....
Virtual(self): pass def func(self, cb): print "%s, %s" % (self.attr1, self.attr2) cb() class Derived(Base): attr1 = 'I am in class Derived' attr2 = 'blah blah' def virtual(self): # do stuff...
I know that the derived class can't access the private members of the base class, so why does the derived class inherit the private members of the base class? Is there any case that it is useful? Thanks!
Started by on , 9 posts by 9 people.  
A derived class....
An instance of the derived class contains instances.
The derived class doesn't "inherit" the private members of the base class in any way - it can't access them, so it doesn't "inherit" them.
From an OOP point of view is there any difference between a derived class and an inherited class? Or is it simply terminology?
Started by on , 6 posts by 6 people.  
The term derived class is preferred C++ parlance for a class that inherits derives Base Class (Sub Class is a derived class of Base Class) and ....
Is called the derived class.
Ask your Facebook Friends
I have a problem and not so sure how to solve it.. Consider the class: public class BaseClass<T> { public T PreviousInstance { get; set; } } Now my secondary data class: public class DataClass : BaseClass<DataClass> { public bool ABoolProperty...
Started by on , 7 posts by 7 people.  
What you can do is carrying over....
Of "I can use an instance of a derived class anywhere that an instance of a base class is requiredHey, You could try shadowing the property as in the following: public class DerivedDataClass.
I have a generic class in my project with derived classes. public class GenericClass <T> : GenericInterface<T> { } public class Test : GenericClass <SomeType> { } Is there any way to find out if a Type object is derived from the GenericClass...
Started by on , 6 posts by 6 people.  
GenericClass implementation inherits from an abstract non-generic base class such as GenericClassBase, you.
Hi, Is it possible to access a base class function which has the same signature as that of a derived class function using a derived class object?. here's a sample of what I'm stating below.. class base1 { public: void test() {cout<<"base1"<<...
Started by on , 3 posts by 3 people.  
class virtual void test(); in your base class.
Test() You cant override a method in derived class if you dint provide a virtual key word..
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 on , 3 posts by 3 people.  
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 ....
Is it possible to assign a base class object to a derived class reference with an explicit typecast in C#?. I have tried it and it creates a run-time error.
Started by on , 7 posts by 7 people.  
A reference to a derived class must actually refer to an instance of the derived....
But you can assign an instance of a derived class to a variable of base class type.
No it is not possible, hence your runtime error.
Here's the scenario: I want define a base class that allocate some buffer once for all derived classes, while the size of the buffer varies among different derived classes. I could achieve it in this way: class base { public: base():size(), p_array(0)...
Started by on , 3 posts by 3 people.  
Alternatively, just add times a p_array....
Sorry but why do you have 2 arrays (and 2 sizes)? Now if you create a derived class you have a 2 private in the base class, so derived classes can access only through Buffer().
I would like to do this: class Derived; class Base { virtual Derived f() = 0; }; class Derived : public Base { }; Of course this doesn't work since I can't return an incomplete type. But neither can I define Derived before base, since I can't inherit ...
Started by on , 7 posts by 7 people.  
Why should anybody inheriting from this class....
You could use a pointer (or a reference): class Derived; class Base { virtual Derived *f() = 0; }; class Derived : public Base { }; But this is code smell to me.
Page: 1   2   3   4   5   6   7   8   9   10  
Related Searches
pointer of derived class type without dynamic_cast   
More Information


Forum Search About Omgili Help Plugins Forum/Board Owners Privacy

i
In Title
In Topic
In Reply
Exclude
Boost