Omgili - forum search, search forums  
  

Discussions about class derived

Displaying 1 - 10 out of 23,768 discussions.  
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...
The pointer of derived class returned by new can be type cast to the pointer of its base class. Is this true or false? I know dynamic_cast can be used to cast downside. Generally, how to cast a pointer of derived class to a pointer of its base class?
Started by on , 5 posts by 5 people.  
This is the whole point of polymorphism: An instance of a derived class should always be safely usable as an instance ....
Conversion from a pointer to a derived class to a pointer to a base class is implicit.
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.
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.
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.
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.
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 ....
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..
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.
I have base class BaseClass and derived classes DerivedA , DerivedB , and DerivedC that all inherit BaseClass . I have another class, ExternalClass with a method that accepts a parameter of type BaseClass , but is actually passed a derived class. What...
Started by on , 7 posts by 7 people.  
When I wrote it I also thought that you could create one method in your ExternalClass instead... .
You shouldn't check for the actual type of the object for every derived class.
Of BaseClass and override it in each derived class.
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