• Register

Recent questions tagged inheritance

0 votes
1 answer 7 views
Problem: I am working with classes and inheritances and I ran into this first error in a much larger program than the one I will present to you: undefined reference to vtable for class xxx Trying to recreate the error in a small program I ran into this error [Error] invalid ... mother { public: baby (string name) { this-> name = name; I appreciate any light you can shed on this issue. Thank you.
asked Jan 25 sasha 8.7k points
0 votes
1 answer 6 views
Problem: I have a question about the use of arrays with polymorphism, the issue is like this: I have an Article class from which two classes Book and Cd inherit. class Article { protected: string nom; public: Article(); virtual empty show () = 0; } class Book: public ... searchByAuthor (); std :: vector <Cd *> searchByComp (); } how can I know which instance is each element of the article vector?
asked Jan 24 sasha 8.7k points
0 votes
1 answer 26 views
Problem: I just recently started learning inheritance in Java. I am a bit confused between method overloading and method overriding. If two classes have same method with different number of arguments, given that the classes have parent-child relationship, will it be overloading or overriding? Moreover, when does the overloading occurs in inherited classes?
asked Jan 8 Code Learner 5.8k points
0 votes
1 answer 40 views
Problem: Hi there! I have been learning to program for a long time now and I recently learned inheritance in Java. I wrote the following program for practice: class Institutions { public void print_institutions() { System.out.println("This is an institution"); } } class ... , I have no idea what is causing this error. Can anybody here please clarify the cause of the error and its solution? Thanks!
asked Dec 29, 2020 Code Learner 5.8k points
0 votes
1 answer 25 views
Problem: Hi there! I recently attempted an exam of Programming in Java. There was a statement that was to be marked as true or false and I had to justify my answer. The statement was: A protected member of a class may be directly accessed by ... concepts in programming and I am not sure whether I understand inheritance properly. Can anybody here help me clear my concepts more accurately? Thanks
asked Dec 27, 2020 Code Learner 5.8k points
0 votes
1 answer 29 views
Problem: Hello Programmers! I just gave an interview for a programming job. The interviewer asked me a question regarding inheritance in Java. The question was: Can subclass access the private members of a superclass? I answered: No!. But, I am still confused about whether I answered correctly or not. Can any of you tell me whether my answer was correct or not? Also, explain why and why not?
asked Dec 17, 2020 Code Learner 5.8k points
0 votes
1 answer 17 views
Problem: a class to inherit from a superclass whose behavior is "close enough" and then to modify behavior as needed. Which overriding method has the same name, number and type of parameters, and return type as the method that it overrides?
asked Dec 5, 2020 Mashhoodch 9.1k points
0 votes
1 answer 49 views
Problem: i am learning php programming , i need assistance can anyone explain me Why multiple inheritance is not supported in PHP? or is there any other way to used inheritance in php?
asked Oct 29, 2020 prog_learner 2.5k points
0 votes
1 answer 19 views
Problem: Can we override inheritted methods in C++? If yes, then how?
asked Oct 14, 2020 Code Learner 5.8k points
0 votes
1 answer 39 views
What is the ambiguity in multiple inheritance in c++
asked Oct 10, 2020 sikandar 2.4k points
0 votes
1 answer 24 views
Problem : What is the difference between public, private, and protected inheritence in c++?
asked Oct 8, 2020 sikandar 2.4k points
0 votes
1 answer 46 views
Problem : This question was asked to us in an open book test and I was lost searching the whole book to find the answer. I was reading Headfirst Java and both the definitions seemed alike. I was just wondering what are the main differences between the inheritence and polymorphism? There are many answers related to this, but none of them seems to be definitive answers.
asked Oct 8, 2020 sikandar 2.4k points
0 votes
1 answer 31 views
1 vote
1 answer 314 views
Problem: Hello all, Please explain to me the error in the following program. class test { String name="name"; public person(String nm){name=nm;} } class emp extends test { String empid="0000"; } public class emptest { public static void main( ... class emp extends test required: String found no arguments reason: actual and formal argument lists differ in length Thanks for the effort. Best regards
asked Mar 10, 2020 Gavin 15.3k points
0 votes
1 answer 77 views
Problems: Can anyone give the right solution? From the choices below select the correct order to code CSS pseudo-classes? a. link, hover, visited, active b. hover, link, active, visited c. link, visited, hover, active d. link, hover, active, visited
asked Feb 14, 2020 maddi86 5.4k points
0 votes
1 answer 81 views
Problem : I have the below two classes public class A {     A() {         System.out.println("A");     } } class B extends A {     B() {         System.out.println("B");     } } And after that running 1 A c = new B(); or 2 B c = new B( ... glance, in either of the scenario, I would assume that only a B constructor would be called and so the only output would be B But this is completely wrong.
asked Jan 23, 2020 jwilliam 3.9k points
0 votes
1 answer 57 views
Problem : I have following two classes: JDialog and JFrame (see signature below). I want them to have few extra methods, but I also want them both to extend my code, without rewriting the code Is it possible to do that? java.awt.Window java.awt.Dialog javax.swing. ... the identical way. So I will not want to write the code twice. I want only one class to utilize the code of the other class.
asked Dec 7, 2019 alecxe 7.5k points
To see more, click for the full list of questions or popular tags.