TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Berkcan Sucu
NA
4
452
Abstract class with maximum member of given classes
May 18 2019 6:56 AM
I've exercise question below Write Class1, Class2 and Class3 content inherited from the abstract class (unlike interface usage, the default class contents will change as a result of override operations on the abstract members of the classes). The abstract class should be written for the highest possible number of members. These are class1,class2, and class 3 below
abstract class ClassAbs { // ……..…?. }
class Class1 : ClassAbs
{
public int number1;
protected double _prop1;
public double property1
{
set { _prop1 = value; }
}
public int property2{ get; }
public int method1(int x) { return x * x * x; } }
class Class2 : ClassAbs
{ public int number1;
public double property1 { get; set; }
public int method1(int x) { return x * x; }}
class Class3 : ClassAbs
{ public int number1;
public double property1 { get; set; } }
Also there's a tip : Tip: ClassAbs represents the abstract class in the given template. Some members of Class1, Class2, and Class3 classes can be found either as complete or just as prototypes. In the abstract class, both the completed members and the prototype descriptions (declaration lines) can be used.
I didn't understand the question well so wanted to ask you.My solution is identifying intersections and inserting into abs class.Variable number1 is common for all classes so put inside Abs class.And also wanted to put prop1 as abstract method to override inside classes.But I couldn't do that. Here's what I tried what do you think?I'm sure there's some part missing in my solution.
abstract class ClassAbs { public int number1; }
Reply
Answers (
2
)
Transformation of XML to HTML using XSLt
Read comma delimited value from sql and retrieve folder